main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
645 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var $TypeError = require('es-errors/type');
|
---|
4 | var callBound = require('call-bound');
|
---|
5 | var isInteger = require('math-intrinsics/isInteger');
|
---|
6 |
|
---|
7 | var $numberToString = callBound('Number.prototype.toString');
|
---|
8 |
|
---|
9 | // https://262.ecma-international.org/14.0/#sec-numeric-types-number-tostring
|
---|
10 |
|
---|
11 | module.exports = function NumberToString(x, radix) {
|
---|
12 | if (typeof x !== 'number') {
|
---|
13 | throw new $TypeError('Assertion failed: `x` must be a Number');
|
---|
14 | }
|
---|
15 | if (!isInteger(radix) || radix < 2 || radix > 36) {
|
---|
16 | throw new $TypeError('Assertion failed: `radix` must be an integer >= 2 and <= 36');
|
---|
17 | }
|
---|
18 |
|
---|
19 | return $numberToString(x, radix); // steps 1 - 12
|
---|
20 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.