mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 10:17:48 +00:00
Fix typo in find.
This commit is contained in:
4
find.js
4
find.js
@@ -26,10 +26,12 @@ import keys from './keys'
|
|||||||
* // => object for 'barney'
|
* // => object for 'barney'
|
||||||
*/
|
*/
|
||||||
function find(collection, predicate, fromIndex) {
|
function find(collection, predicate, fromIndex) {
|
||||||
|
let iteratee
|
||||||
const iterable = Object(collection)
|
const iterable = Object(collection)
|
||||||
|
|
||||||
if (!isArrayLike(collection)) {
|
if (!isArrayLike(collection)) {
|
||||||
collection = keys(collection)
|
collection = keys(collection)
|
||||||
predicate = (key) => iteratee(iterable[key], key, iterable)
|
iteratee = (key) => predicate(iterable[key], key, iterable)
|
||||||
}
|
}
|
||||||
const index = findIndex(collection, predicate, fromIndex)
|
const index = findIndex(collection, predicate, fromIndex)
|
||||||
return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined
|
return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined
|
||||||
|
|||||||
Reference in New Issue
Block a user