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.
parttimejob/node_modules/core-js/modules/esnext.string.at.js

20 lines
786 B

'use strict';
// TODO: Remove from `core-js@4`
var $ = require('../internals/export');
var charAt = require('../internals/string-multibyte').charAt;
var requireObjectCoercible = require('../internals/require-object-coercible');
var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
var toString = require('../internals/to-string');
// `String.prototype.at` method
// https://github.com/mathiasbynens/String.prototype.at
$({ target: 'String', proto: true, forced: true }, {
at: function at(index) {
var S = toString(requireObjectCoercible(this));
var len = S.length;
var relativeIndex = toIntegerOrInfinity(index);
var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex;
return (k < 0 || k >= len) ? undefined : charAt(S, k);
}
});