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,8 +1,4 @@
import baseIndexOf from './.internal/baseIndexOf.js'
import toInteger from './toInteger.js'
/* Built-in method references for those with the same name as other `lodash` methods. */
const nativeMax = Math.max
/**
* Gets the index at which the first occurrence of `value` is found in `array`
@@ -30,9 +26,9 @@ function indexOf(array, value, fromIndex) {
if (!length) {
return -1
}
let index = fromIndex == null ? 0 : toInteger(fromIndex)
let index = fromIndex == null ? 0 : +fromIndex
if (index < 0) {
index = nativeMax(length + index, 0)
index = Math.max(length + index, 0)
}
return baseIndexOf(array, value, index)
}