Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

esnext.array.last-index.js 743B

12345678910111213141516171819202122
  1. 'use strict';
  2. // TODO: Remove from `core-js@4`
  3. var DESCRIPTORS = require('../internals/descriptors');
  4. var addToUnscopables = require('../internals/add-to-unscopables');
  5. var toObject = require('../internals/to-object');
  6. var lengthOfArrayLike = require('../internals/length-of-array-like');
  7. var defineBuiltInAccessor = require('../internals/define-built-in-accessor');
  8. // `Array.prototype.lastIndex` getter
  9. // https://github.com/keithamus/proposal-array-last
  10. if (DESCRIPTORS) {
  11. defineBuiltInAccessor(Array.prototype, 'lastIndex', {
  12. configurable: true,
  13. get: function lastIndex() {
  14. var O = toObject(this);
  15. var len = lengthOfArrayLike(O);
  16. return len === 0 ? 0 : len - 1;
  17. }
  18. });
  19. addToUnscopables('lastIndex');
  20. }