source: imaps-frontend/node_modules/core-js/modules/esnext.string.at.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 786 bytes
Line 
1'use strict';
2// TODO: Remove from `core-js@4`
3var $ = require('../internals/export');
4var charAt = require('../internals/string-multibyte').charAt;
5var requireObjectCoercible = require('../internals/require-object-coercible');
6var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
7var toString = require('../internals/to-string');
8
9// `String.prototype.at` method
10// https://github.com/mathiasbynens/String.prototype.at
11$({ target: 'String', proto: true, forced: true }, {
12 at: function at(index) {
13 var S = toString(requireObjectCoercible(this));
14 var len = S.length;
15 var relativeIndex = toIntegerOrInfinity(index);
16 var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex;
17 return (k < 0 || k >= len) ? undefined : charAt(S, k);
18 }
19});
Note: See TracBrowser for help on using the repository browser.