debian-mirror-gitlab/core-js/internals/this-number-value.js
2019-09-25 13:30:05 +05:30

10 lines
316 B
JavaScript

var classof = require('../internals/classof-raw');
// `thisNumberValue` abstract operation
// https://tc39.github.io/ecma262/#sec-thisnumbervalue
module.exports = function (value) {
if (typeof value != 'number' && classof(value) != 'Number') {
throw TypeError('Incorrect invocation');
}
return +value;
};