Closed jnordstrom1983 closed 7 years ago
The added functions to the array object shouldn't be enumerable as they may break other plugins that enumerates all properties in an array.
Steps to reproduce the issue:
var tempArray = [1,2,3]; for(var i in tempArray){ console.log(tempArray[i]) }
Expected result: [Log] 1 [Log] 2 [Log] 3
[Log] 1 [Log] 2 [Log] 3
Result:
[Log] 1 [Log] 2 [Log] 3 [Log] function () { ... } [Log] function (index) { ... } [Log] function (item) { ... }
Fix: I've added this to my app to resolve this issue.
if(Array.prototype.peek){ Object.defineProperty(Array.prototype, "peek", { enumerable : false }); } if(Array.prototype.removeAt){ Object.defineProperty(Array.prototype, "removeAt", { enumerable : false }); } if(Array.prototype.remove){ Object.defineProperty(Array.prototype, "remove", { enumerable : false }); }
Thank you so much for the report! I've just committed the fix.
The added functions to the array object shouldn't be enumerable as they may break other plugins that enumerates all properties in an array.
Steps to reproduce the issue:
Expected result:
[Log] 1 [Log] 2 [Log] 3
Result:
Fix: I've added this to my app to resolve this issue.