debian-mirror-gitlab/core-js/internals/this-number-value.js

11 lines
316 B
JavaScript
Raw Normal View History

2019-09-25 13:30:05 +05:30
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;
};