MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / createFind

Function createFind

lib/web/jshint.js:4792–4801  ·  view source on GitHub ↗

* Creates a `_.find` or `_.findLast` function. * * @private * @param {Function} eachFunc The function to iterate over a collection. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new find function.

(eachFunc, fromRight)

Source from the content-addressed store, hash-verified

4790 * @returns {Function} Returns the new find function.
4791 */
4792 function createFind(eachFunc, fromRight) {
4793 return function(collection, predicate, thisArg) {
4794 predicate = getCallback(predicate, thisArg, 3);
4795 if (isArray(collection)) {
4796 var index = baseFindIndex(collection, predicate, fromRight);
4797 return index > -1 ? collection[index] : undefined;
4798 }
4799 return baseFind(collection, predicate, eachFunc);
4800 }
4801 }
4802
4803 /**
4804 * Creates a `_.findIndex` or `_.findLastIndex` function.

Callers 1

runInContextFunction · 0.85

Calls 4

getCallbackFunction · 0.85
baseFindIndexFunction · 0.85
baseFindFunction · 0.85
isArrayFunction · 0.70

Tested by

no test coverage detected