MCPcopy
hub / github.com/deployd/deployd / createFind

Function createFind

test-app/public/sinon.js:15682–15693  ·  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

15680 * @returns {Function} Returns the new find function.
15681 */
15682 function createFind(findIndexFunc) {
15683 return function(collection, predicate, fromIndex) {
15684 var iterable = Object(collection);
15685 if (!isArrayLike(collection)) {
15686 var iteratee = getIteratee(predicate, 3);
15687 collection = keys(collection);
15688 predicate = function(key) { return iteratee(iterable[key], key, iterable); };
15689 }
15690 var index = findIndexFunc(collection, predicate, fromIndex);
15691 return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
15692 };
15693 }
15694
15695 /**
15696 * Creates a `_.flow` or `_.flowRight` function.

Callers 1

sinon.jsFile · 0.85

Calls 4

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

Tested by

no test coverage detected