* 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)
| 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. |
no test coverage detected