Skip to content

Commit a6fe50f

Browse files
committed
- Fix to iterate over only own or enumerable properties of the array
using forEach method. - Provided fall back for IE8 whih does not have forEach method for array's.
1 parent 24582f9 commit a6fe50f

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/filterJSON.plugin.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,19 @@
115115
}
116116
};
117117

118-
for(k in valueArray) {
119-
innerComparo(type, j, valueArray[k]);
118+
// forEach iterates over enumerable properties
119+
if(valueArray.forEach) {
120+
valueArray.forEach(function(element, index, array) {
121+
innerComparo(type, j, element);
122+
});
123+
}
124+
else {
125+
// fall-back for IE8
126+
for(k in valueArray) {
127+
if(valueArray.hasOwnProperty(k)) {
128+
innerComparo(type, j, valueArray[k]);
129+
}
130+
}
120131
}
121132
}
122133
else {

src/filterJSON.plugin.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)