source: imaps-frontend/node_modules/es-abstract/2020/CanonicalNumericIndexString.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 572 bytes
Line 
1'use strict';
2
3var $TypeError = require('es-errors/type');
4
5var SameValue = require('./SameValue');
6var ToNumber = require('./ToNumber');
7var ToString = require('./ToString');
8
9// https://262.ecma-international.org/6.0/#sec-canonicalnumericindexstring
10
11module.exports = function CanonicalNumericIndexString(argument) {
12 if (typeof argument !== 'string') {
13 throw new $TypeError('Assertion failed: `argument` must be a String');
14 }
15 if (argument === '-0') { return -0; }
16 var n = ToNumber(argument);
17 if (SameValue(ToString(n), argument)) { return n; }
18 return void 0;
19};
Note: See TracBrowser for help on using the repository browser.