thisNumberValue.js 390 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://ecma-international.org/ecma-262/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. };