main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
973 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 | /* eslint-disable es/no-array-prototype-indexof -- required for testing */
|
---|
3 | var $ = require('../internals/export');
|
---|
4 | var uncurryThis = require('../internals/function-uncurry-this-clause');
|
---|
5 | var $indexOf = require('../internals/array-includes').indexOf;
|
---|
6 | var arrayMethodIsStrict = require('../internals/array-method-is-strict');
|
---|
7 |
|
---|
8 | var nativeIndexOf = uncurryThis([].indexOf);
|
---|
9 |
|
---|
10 | var NEGATIVE_ZERO = !!nativeIndexOf && 1 / nativeIndexOf([1], 1, -0) < 0;
|
---|
11 | var FORCED = NEGATIVE_ZERO || !arrayMethodIsStrict('indexOf');
|
---|
12 |
|
---|
13 | // `Array.prototype.indexOf` method
|
---|
14 | // https://tc39.es/ecma262/#sec-array.prototype.indexof
|
---|
15 | $({ target: 'Array', proto: true, forced: FORCED }, {
|
---|
16 | indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
|
---|
17 | var fromIndex = arguments.length > 1 ? arguments[1] : undefined;
|
---|
18 | return NEGATIVE_ZERO
|
---|
19 | // convert -0 to +0
|
---|
20 | ? nativeIndexOf(this, searchElement, fromIndex) || 0
|
---|
21 | : $indexOf(this, searchElement, fromIndex);
|
---|
22 | }
|
---|
23 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.