Urara-Blog/node_modules/.pnpm-store/v3/files/2d/d762034574d09580e8f9e7d98c42c3081aa4adf760672690364c0b991ef1f392bf8472e26013e31bfa98806d910467638d1b496c79ccf32b5bfc743e4cb542
2022-08-14 01:14:53 +08:00

22 lines
654 B
Text

'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var SameValue = require('./SameValue');
var ToNumber = require('./ToNumber');
var ToString = require('./ToString');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-canonicalnumericindexstring
module.exports = function CanonicalNumericIndexString(argument) {
if (Type(argument) !== 'String') {
throw new $TypeError('Assertion failed: `argument` must be a String');
}
if (argument === '-0') { return -0; }
var n = ToNumber(argument);
if (SameValue(ToString(n), argument)) { return n; }
return void 0;
};