esnext.array.to-spliced.js 792 B

1234567891011121314151617181920
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var global = require('../internals/global');
  4. var toIndexedObject = require('../internals/to-indexed-object');
  5. var arraySlice = require('../internals/array-slice');
  6. var arrayToSpliced = require('../internals/array-to-spliced');
  7. var addToUnscopables = require('../internals/add-to-unscopables');
  8. var Array = global.Array;
  9. // `Array.prototype.toSpliced` method
  10. // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toSpliced
  11. $({ target: 'Array', proto: true }, {
  12. // eslint-disable-next-line no-unused-vars -- required for .length
  13. toSpliced: function toSpliced(start, deleteCount /* , ...items */) {
  14. return arrayToSpliced(toIndexedObject(this), Array, arraySlice(arguments));
  15. }
  16. });
  17. addToUnscopables('toSpliced');