main
Last change
on this file since d565449 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
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var $TypeError = require('es-errors/type');
|
---|
| 4 |
|
---|
| 5 | var SameValue = require('./SameValue');
|
---|
| 6 | var ToNumber = require('./ToNumber');
|
---|
| 7 | var ToString = require('./ToString');
|
---|
| 8 |
|
---|
| 9 | // https://262.ecma-international.org/6.0/#sec-canonicalnumericindexstring
|
---|
| 10 |
|
---|
| 11 | module.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.