es2017.js 633 B

12345678910111213141516171819202122232425
  1. 'use strict';
  2. var ES2016 = require('./es2016');
  3. var assign = require('./helpers/assign');
  4. var ES2017 = assign(assign({}, ES2016), {
  5. ToIndex: function ToIndex(value) {
  6. if (typeof value === 'undefined') {
  7. return 0;
  8. }
  9. var integerIndex = this.ToInteger(value);
  10. if (integerIndex < 0) {
  11. throw new RangeError('index must be >= 0');
  12. }
  13. var index = this.ToLength(integerIndex);
  14. if (!this.SameValueZero(integerIndex, index)) {
  15. throw new RangeError('index must be >= 0 and < 2 ** 53 - 1');
  16. }
  17. return index;
  18. }
  19. });
  20. delete ES2017.EnumerableOwnNames; // replaced with EnumerableOwnProperties
  21. module.exports = ES2017;