MCPcopy
hub / github.com/vercel/hyper / createFind

Function createFind

bin/yarn-standalone.js:12793–12804  ·  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

12791 * @returns {Function} Returns the new find function.
12792 */
12793 function createFind(findIndexFunc) {
12794 return function(collection, predicate, fromIndex) {
12795 var iterable = Object(collection);
12796 if (!isArrayLike(collection)) {
12797 var iteratee = getIteratee(predicate, 3);
12798 collection = keys(collection);
12799 predicate = function(key) { return iteratee(iterable[key], key, iterable); };
12800 }
12801 var index = findIndexFunc(collection, predicate, fromIndex);
12802 return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
12803 };
12804 }
12805
12806 /**
12807 * Creates a `_.flow` or `_.flowRight` function.

Callers 1

yarn-standalone.jsFile · 0.85

Calls 4

isArrayLikeFunction · 0.85
getIterateeFunction · 0.85
iterateeFunction · 0.85
keysFunction · 0.70

Tested by

no test coverage detected