'use strict'; /** * Iterate over an Array or an Object invoking a function for each item. * * If `obj` is an Array or arguments callback will be called passing * the value, index, and complete array for each item. * * If 'obj' is an Object callback will be called passing * the value, key, and complete object for each property. * * @param {Object|Array} obj The object to iterate * @param {Function} fn The callback to invoke for each item */ module.exports = function forEach(obj, fn) { if (typeof obj !== 'object') { return; } // Iterate over array values if (obj.constructor === Array || typeof obj.callee === 'function') { for (var i=0, l=obj.length; i