| 12345678910111213141516171819202122232425262728 |
- 'use strict';
- var $ = require('../internals/export');
- var $includes = require('../internals/array-includes').includes;
- var fails = require('../internals/fails');
- var addToUnscopables = require('../internals/add-to-unscopables');
- // FF99+ bug
- var BROKEN_ON_SPARSE = fails(function () {
- // eslint-disable-next-line es/no-array-prototype-includes -- detection
- return !Array(1).includes();
- });
- // Safari 26.4- bug
- var BROKEN_ON_SPARSE_WITH_FROM_INDEX = fails(function () {
- // eslint-disable-next-line no-sparse-arrays, es/no-array-prototype-includes -- detection
- return [, 1].includes(undefined, 1);
- });
- // `Array.prototype.includes` method
- // https://tc39.es/ecma262/#sec-array.prototype.includes
- $({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE || BROKEN_ON_SPARSE_WITH_FROM_INDEX }, {
- includes: function includes(el /* , fromIndex = 0 */) {
- return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
- addToUnscopables('includes');
|