linwenling
2023-07-25 7ca95d0b01940011b16f03683e59ab4f18fff4e0
1
2
3
4
5
6
7
8
9
10
11
12
var toPrimitive = require('../internals/to-primitive');
 
var $TypeError = TypeError;
 
// `ToBigInt` abstract operation
// https://tc39.es/ecma262/#sec-tobigint
module.exports = function (argument) {
  var prim = toPrimitive(argument, 'number');
  if (typeof prim == 'number') throw $TypeError("Can't convert number to bigint");
  // eslint-disable-next-line es/no-bigint -- safe
  return BigInt(prim);
};