source: imaps-frontend/node_modules/es-abstract/2023/Number/toString.js@ 79a0317

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
3var $TypeError = require('es-errors/type');
4var callBound = require('call-bound');
5var isInteger = require('math-intrinsics/isInteger');
6
7var $numberToString = callBound('Number.prototype.toString');
8
9// https://262.ecma-international.org/14.0/#sec-numeric-types-number-tostring
10
11module.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.