equal.js 464 B

1234567891011121314151617
  1. 'use strict';
  2. var GetIntrinsic = require('get-intrinsic');
  3. var $TypeError = GetIntrinsic('%TypeError%');
  4. var Type = require('../Type');
  5. // https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-equal
  6. module.exports = function BigIntEqual(x, y) {
  7. if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') {
  8. throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
  9. }
  10. // shortcut for the actual spec mechanics
  11. return x === y;
  12. };