RyanMarcus / dirty-json

A parser for invalid JSON

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enumerable properties of arrays

Moai- opened this issue · comments

commented

Thank you for the great project, it helped enormously with loosening the requirements around quotes and such. That said, the project completely breaks all for/in loops because it adds peek and last methods to all arrays, and the loop thinks it's an index. These need to be non-enumerable; I will submit a PR if necessary.

Wow, I didn't realize that I was modifying the global prototype of Array. That's definitely no good. Is there a way to only modify the prototype locally? Or should I just refactor the code?

commented

Yessir, there is. You define them using Object.defineProperty; I have submitted a pull request for your convenience.

Awesome! Thanks so much.
Fixed version available on NPM, 0.9.0.

commented

Confirm that issue is fixed on 0.9.0, thanks for the bump.