2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-08 17:22:34 +03:00

[for-each] has-own-prop issue node

This commit is contained in:
Tony L. Kerz
2016-09-11 09:15:22 -04:00
parent 755a9b3459
commit 077153a0a7
2 changed files with 13 additions and 1 deletions
+1 -1
View File
@@ -217,7 +217,7 @@ function forEach(obj, fn) {
} else {
// Iterate over object keys
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
if (Object.hasOwnProperty.call(obj, key)) {
fn.call(null, obj[key], key, obj);
}
}
+12
View File
@@ -48,4 +48,16 @@ describe('utils::forEach', function () {
expect(count).toEqual(1);
});
it('should handle non object prototype gracefully', function () {
var count = 0;
var data = Object.create(null);
data.foo = 'bar'
forEach(function () {}, function () {
count++;
});
expect(count).toEqual(1);
});
});