Sha256: 1f1e593df8b3df4ff3a8da8b580a1c645b0df19d0bd816941e1f07d2bbe946ee
Contents?: true
Size: 1.07 KB
Versions: 69
Compression:
Stored size: 1.07 KB
Contents
define(['./identity', './prop', '../object/deepMatches'], function(identity, prop, deepMatches) { /** * Converts argument into a valid iterator. * Used internally on most array/object/collection methods that receives a * callback/iterator providing a shortcut syntax. */ function makeIterator(src, thisObj){ if (src == null) { return identity; } switch(typeof src) { case 'function': // function is the first to improve perf (most common case) // also avoid using `Function#call` if not needed, which boosts // perf a lot in some cases return (typeof thisObj !== 'undefined')? function(val, i, arr){ return src.call(thisObj, val, i, arr); } : src; case 'object': return function(val){ return deepMatches(val, src); }; case 'string': case 'number': return prop(src); } } return makeIterator; });
Version data entries
69 entries across 69 versions & 2 rubygems