NumberToString.js 432 B

12345678910111213141516171819
  1. 'use strict';
  2. var GetIntrinsic = require('get-intrinsic');
  3. var $String = GetIntrinsic('%String%');
  4. var $TypeError = GetIntrinsic('%TypeError%');
  5. var Type = require('./Type');
  6. // https://262.ecma-international.org/9.0/#sec-tostring-applied-to-the-number-type
  7. module.exports = function NumberToString(m) {
  8. if (Type(m) !== 'Number') {
  9. throw new $TypeError('Assertion failed: "m" must be a String');
  10. }
  11. return $String(m);
  12. };