Sha256: 27547c5d02107f110a0bd3d03e0d22252affc5016ba46eb57efea1905827e85f
Contents?: true
Size: 927 Bytes
Versions: 167
Compression:
Stored size: 927 Bytes
Contents
/** * The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey`, * without support for callback shorthands and `this` binding, which iterates * over `collection` using the provided `eachFunc`. * * @private * @param {Array|Object|string} collection The collection to search. * @param {Function} predicate The function invoked per iteration. * @param {Function} eachFunc The function to iterate over `collection`. * @param {boolean} [retKey] Specify returning the key of the found element * instead of the element itself. * @returns {*} Returns the found element or its key, else `undefined`. */ function baseFind(collection, predicate, eachFunc, retKey) { var result; eachFunc(collection, function(value, key, collection) { if (predicate(value, key, collection)) { result = retKey ? key : value; return false; } }); return result; } module.exports = baseFind;
Version data entries
167 entries across 87 versions & 9 rubygems