foreach
Advanced tools
Comparing version 2.0.3 to 2.0.4
var hasOwn = Object.prototype.hasOwnProperty; | ||
var toString = Object.prototype.toString; | ||
module.exports = function forEach (obj, fn, ctx) { | ||
if (typeof fn !== 'function') { | ||
if (toString.call(fn) !== '[object Function]') { | ||
throw new TypeError('iterator must be a function'); | ||
@@ -7,0 +8,0 @@ } |
{ | ||
"name": "foreach", | ||
"description": "foreach component + npm package", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"author": "Manuel Stofer <manuel@takimata.ch>", | ||
"contributors": [ | ||
{ | ||
"name": "Manuel Stofer" | ||
}, | ||
{ | ||
"name": "Jordan Harband", | ||
"url": "https://github.com/ljharb" | ||
} | ||
], | ||
"license": "MIT", | ||
@@ -40,3 +49,4 @@ "main": "index.js", | ||
"ipad/6.0..latest", | ||
"iphone/6.0..latest" | ||
"iphone/6.0..latest", | ||
"android-browser/4.2" | ||
] | ||
@@ -43,0 +53,0 @@ } |
15
test.js
@@ -16,2 +16,6 @@ var test = require('tape'); | ||
t.doesNotThrow(function () { forEach(arr, function () {}); }, 'function is a function'); | ||
t.doesNotThrow(function () { forEach(arr, setTimeout); }, 'setTimeout is a function'); | ||
if (typeof window !== 'undefined') { | ||
t.doesNotThrow(function () { forEach(arr, window.alert); }, 'alert is a function'); | ||
} | ||
t.end(); | ||
@@ -37,2 +41,3 @@ }); | ||
}); | ||
st.end(); | ||
}); | ||
@@ -47,2 +52,3 @@ | ||
}); | ||
st.end(); | ||
}); | ||
@@ -55,2 +61,3 @@ | ||
}); | ||
st.end(); | ||
}); | ||
@@ -105,2 +112,3 @@ | ||
}); | ||
st.end(); | ||
}); | ||
@@ -115,2 +123,3 @@ | ||
}); | ||
st.end(); | ||
}); | ||
@@ -123,2 +132,3 @@ | ||
}); | ||
st.end(); | ||
}); | ||
@@ -145,3 +155,3 @@ | ||
st.equal(counter, index, 'index ' + index + ' is passed as second argument'); | ||
st.equal(str[index], item); | ||
st.equal(str.charAt(index), item); | ||
counter += 1; | ||
@@ -152,2 +162,3 @@ }); | ||
t.end(); | ||
}); | ||
}); | ||
Sorry, the diff of this file is not supported yet
36969
164