var toString = ({}).toString; var hasOwnProp = ({}).hasOwnProperty; var utils = { noop: function noop() {}, isString: function isString(str) { return typeof str === 'string'; }, forEach: function forEach(obj, fn) { for (var key in obj) { if (hasOwnProp.call(obj, key)) { fn(key, obj[key]); } } }, assign: function assign (dest, methods) { utils.forEach(methods, function (key, val) { dest[key] = val; }); } }; function checkType(type) { return function _checkType(val) { return toString.call(val) === '[object ' + type + ']'; }; } // add isRegExp, isArray, isFunction ['RegExp', 'Array', 'Function'].forEach(function addIsChecks(type) { utils['is' + type] = checkType(type); }); module.exports = utils;