Permalink
codeql-action/node_modules/es-abstract/2020/thisBigIntValue.js
Newer
100644
22 lines (17 sloc)
557 Bytes
Ignoring revisions in .git-blame-ignore-revs.
3
var GetIntrinsic = require('get-intrinsic');
4
var callBound = require('call-bind/callBound');
6
var $SyntaxError = GetIntrinsic('%SyntaxError%');
7
var $bigIntValueOf = callBound('BigInt.prototype.valueOf', true);
8
9
var Type = require('./Type');
10
11
// https://262.ecma-international.org/11.0/#sec-thisbigintvalue
12
13
module.exports = function thisBigIntValue(value) {
14
var type = Type(value);
15
if (type === 'BigInt') {
16
return value;
17
}
18
if (!$bigIntValueOf) {
19
throw new $SyntaxError('BigInt is not supported');