source: trip-planner-front/node_modules/core-js/modules/esnext.array.at.js@ 571e0df

Last change on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 689 bytes
Line 
1'use strict';
2var $ = require('../internals/export');
3var toObject = require('../internals/to-object');
4var toLength = require('../internals/to-length');
5var toInteger = require('../internals/to-integer');
6var addToUnscopables = require('../internals/add-to-unscopables');
7
8// `Array.prototype.at` method
9// https://github.com/tc39/proposal-relative-indexing-method
10$({ target: 'Array', proto: true }, {
11 at: function at(index) {
12 var O = toObject(this);
13 var len = toLength(O.length);
14 var relativeIndex = toInteger(index);
15 var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex;
16 return (k < 0 || k >= len) ? undefined : O[k];
17 }
18});
19
20addToUnscopables('at');
Note: See TracBrowser for help on using the repository browser.