Remove coercion method use.

This commit is contained in:
John-David Dalton
2017-03-13 20:49:45 -07:00
parent 2f281c68b0
commit bb7c959479
33 changed files with 59 additions and 194 deletions

View File

@@ -1,9 +1,4 @@
import baseFindIndex from './.internal/baseFindIndex.js'
import toInteger from './toInteger.js'
/* Built-in method references for those with the same name as other `lodash` methods. */
const nativeMax = Math.max
const nativeMin = Math.min
/**
* This method is like `findIndex` except that it iterates over elements
@@ -34,10 +29,9 @@ function findLastIndex(array, predicate, fromIndex) {
}
let index = length - 1
if (fromIndex !== undefined) {
index = toInteger(fromIndex)
index = fromIndex < 0
? nativeMax(length + index, 0)
: nativeMin(index, length - 1)
? Math.max(length + fromIndex, 0)
: Math.min(fromIndex, length - 1)
}
return baseFindIndex(array, predicate, index, true)
}