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