thisNumberValue.js 385 B

123456789101112131415161718
  1. 'use strict';
  2. var callBound = require('call-bind/callBound');
  3. var Type = require('./Type');
  4. var $NumberValueOf = callBound('Number.prototype.valueOf');
  5. // https://262.ecma-international.org/6.0/#sec-properties-of-the-number-prototype-object
  6. module.exports = function thisNumberValue(value) {
  7. if (Type(value) === 'Number') {
  8. return value;
  9. }
  10. return $NumberValueOf(value);
  11. };