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,11 +1,6 @@
import baseFindIndex from './.internal/baseFindIndex.js'
import baseIsNaN from './.internal/baseIsNaN.js'
import strictLastIndexOf from './.internal/strictLastIndexOf.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 `indexOf` except that it iterates over elements of
@@ -33,8 +28,7 @@ function lastIndexOf(array, value, fromIndex) {
}
let index = length
if (fromIndex !== undefined) {
index = toInteger(fromIndex)
index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1)
index = index < 0 ? Math.max(length + index, 0) : Math.min(index, length - 1)
}
return value === value
? strictLastIndexOf(array, value, index)