Use hasOwnProperty when iterating an array

This was breaking due to the fact that `for in` iterates inherited properties, so the check on line 24 was running into inherited methods like `slice` and bailing.