|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.0 KB
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 | var $ = require('../internals/export');
|
|---|
| 3 | var $includes = require('../internals/array-includes').includes;
|
|---|
| 4 | var fails = require('../internals/fails');
|
|---|
| 5 | var addToUnscopables = require('../internals/add-to-unscopables');
|
|---|
| 6 |
|
|---|
| 7 | // FF99+ bug
|
|---|
| 8 | var BROKEN_ON_SPARSE = fails(function () {
|
|---|
| 9 | // eslint-disable-next-line es/no-array-prototype-includes -- detection
|
|---|
| 10 | return !Array(1).includes();
|
|---|
| 11 | });
|
|---|
| 12 |
|
|---|
| 13 | // Safari 26.4- bug
|
|---|
| 14 | var BROKEN_ON_SPARSE_WITH_FROM_INDEX = fails(function () {
|
|---|
| 15 | // eslint-disable-next-line no-sparse-arrays, es/no-array-prototype-includes -- detection
|
|---|
| 16 | return [, 1].includes(undefined, 1);
|
|---|
| 17 | });
|
|---|
| 18 |
|
|---|
| 19 | // `Array.prototype.includes` method
|
|---|
| 20 | // https://tc39.es/ecma262/#sec-array.prototype.includes
|
|---|
| 21 | $({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE || BROKEN_ON_SPARSE_WITH_FROM_INDEX }, {
|
|---|
| 22 | includes: function includes(el /* , fromIndex = 0 */) {
|
|---|
| 23 | return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
|---|
| 24 | }
|
|---|
| 25 | });
|
|---|
| 26 |
|
|---|
| 27 | // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|---|
| 28 | addToUnscopables('includes');
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.