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