esnext.array.with.js 450 B

1234567891011121314
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var arrayWith = require('../internals/array-with');
  4. var toIndexedObject = require('../internals/to-indexed-object');
  5. var $Array = Array;
  6. // `Array.prototype.with` method
  7. // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.with
  8. $({ target: 'Array', proto: true }, {
  9. 'with': function (index, value) {
  10. return arrayWith(toIndexedObject(this), $Array, index, value);
  11. }
  12. });