this-number-value.js 309 B

12345678910
  1. var classof = require('../internals/classof-raw');
  2. // `thisNumberValue` abstract operation
  3. // https://tc39.es/ecma262/#sec-thisnumbervalue
  4. module.exports = function (value) {
  5. if (typeof value != 'number' && classof(value) != 'Number') {
  6. throw TypeError('Incorrect invocation');
  7. }
  8. return +value;
  9. };