MCPcopy Create free account
hub / github.com/RubyLouvre/anu / createFind

Function createFind

test/babel.js:28248–28261  ·  view source on GitHub ↗

* Creates a `_.find` or `_.findLast` function. * * @private * @param {Function} findIndexFunc The function to find the collection index. * @returns {Function} Returns the new find function.

(findIndexFunc)

Source from the content-addressed store, hash-verified

28246 * @returns {Function} Returns the new find function.
28247 */
28248 function createFind(findIndexFunc) {
28249 return function (collection, predicate, fromIndex) {
28250 var iterable = Object(collection);
28251 if (!isArrayLike(collection)) {
28252 var iteratee = baseIteratee(predicate, 3);
28253 collection = keys(collection);
28254 predicate = function predicate(key) {
28255 return iteratee(iterable[key], key, iterable);
28256 };
28257 }
28258 var index = findIndexFunc(collection, predicate, fromIndex);
28259 return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
28260 };
28261 }
28262
28263 module.exports = createFind;
28264

Callers 1

babel.jsFile · 0.85

Calls 3

baseIterateeFunction · 0.85
keysFunction · 0.85
isArrayLikeFunction · 0.70

Tested by

no test coverage detected