Sha256: 7da14af37930a74ed573b50152b6b997d6e01667524ff872606de0ac0dbe4afd
Contents?: true
Size: 639 Bytes
Versions: 69
Compression:
Stored size: 639 Bytes
Contents
define(['./forOwn', './size'], function(forOwn, size) { /** * Object reduce */ function reduce(obj, callback, memo, thisObj) { var initial = arguments.length > 2; if (!size(obj) && !initial) { throw new Error('reduce of empty object with no initial value'); } forOwn(obj, function(value, key, list) { if (!initial) { memo = value; initial = true; } else { memo = callback.call(thisObj, memo, value, key, list); } }); return memo; } return reduce; });
Version data entries
69 entries across 69 versions & 2 rubygems