MCPcopy
hub / github.com/lodash/lodash / indexOf

Function indexOf

lodash.js:7545–7555  ·  view source on GitHub ↗

* Gets the index at which the first occurrence of `value` is found in `array` * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. If `fromIndex` is negative, it's used as the * offset from the end of `array`. *

(array, value, fromIndex)

Source from the content-addressed store, hash-verified

7543 * // => 3
7544 */
7545 function indexOf(array, value, fromIndex) {
7546 var length = array == null ? 0 : array.length;
7547 if (!length) {
7548 return -1;
7549 }
7550 var index = fromIndex == null ? 0 : toInteger(fromIndex);
7551 if (index < 0) {
7552 index = nativeMax(length + index, 0);
7553 }
7554 return baseIndexOf(array, value, index);
7555 }
7556
7557 /**
7558 * Gets all but the last element of `array`.

Callers 1

basePullAllFunction · 0.85

Calls 2

toIntegerFunction · 0.85
baseIndexOfFunction · 0.85

Tested by

no test coverage detected