Skip to content

Commit

Permalink
In older browsers, regexes are considered functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Aug 17, 2013
1 parent 4c9125c commit 4eab3bc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

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');
}
var l = obj.length;
Expand Down

0 comments on commit 4eab3bc

Please sign in to comment.