mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 10:07:48 +00:00
Remove coercion method use.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user