es.array.includes.js 766 B

123456789101112131415161718
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var $includes = require('../internals/array-includes').includes;
  4. var addToUnscopables = require('../internals/add-to-unscopables');
  5. var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');
  6. var USES_TO_LENGTH = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });
  7. // `Array.prototype.includes` method
  8. // https://tc39.github.io/ecma262/#sec-array.prototype.includes
  9. $({ target: 'Array', proto: true, forced: !USES_TO_LENGTH }, {
  10. includes: function includes(el /* , fromIndex = 0 */) {
  11. return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
  12. }
  13. });
  14. // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
  15. addToUnscopables('includes');