Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #5 from grncdr/use-is-function
Browse files Browse the repository at this point in the history
works down to IE6
  • Loading branch information
Raynos committed Jan 7, 2014
2 parents fb9de75 + 25bbf65 commit 4c5b145
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion index.js
@@ -1,10 +1,12 @@
var isFunction = require('is-function')

module.exports = forEach

var toString = Object.prototype.toString
var hasOwnProperty = Object.prototype.hasOwnProperty

function forEach(list, iterator, context) {
if (toString.call(iterator) !== '[object Function]') {
if (!isFunction(iterator)) {
throw new TypeError('iterator must be a function')
}

Expand Down
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -20,7 +20,9 @@
"url": "https://github.com/Raynos/for-each/issues",
"email": "raynos2@gmail.com"
},
"dependencies": {},
"dependencies": {
"is-function": "~1.0.0"
},
"devDependencies": {
"tape": "~1.1.0"
},
Expand Down

0 comments on commit 4c5b145

Please sign in to comment.