MCPcopy
hub / github.com/lodash/lodash / createFind

Function createFind

lodash.js:5144–5155  ·  lodash.js::createFind

* 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

5142 * @returns {Function} Returns the new find function.
5143 */
5144 function createFind(findIndexFunc) {
5145 return function(collection, predicate, fromIndex) {
5146 var iterable = Object(collection);
5147 if (!isArrayLike(collection)) {
5148 var iteratee = getIteratee(predicate, 3);
5149 collection = keys(collection);
5150 predicate = function(key) { return iteratee(iterable[key], key, iterable); };
5151 }
5152 var index = findIndexFunc(collection, predicate, fromIndex);
5153 return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
5154 };
5155 }
5156
5157 /**
5158 * Creates a `_.flow` or `_.flowRight` function.

Callers 1

lodash.jsFile · 0.85

Calls 4

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

Tested by

no test coverage detected