leftShift.js 472 B

123456789101112131415161718
  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-leftShift
  6. module.exports = function BigIntLeftShift(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. };