blob: c617f388dea72e00af72319427af0554e296aad9 [file] [log] [blame]
Leo Repp58b9f112021-11-22 11:57:47 +01001'use strict';
2
3var GetIntrinsic = require('get-intrinsic');
4
5var $TypeError = GetIntrinsic('%TypeError%');
6
7// https://262.ecma-international.org/11.0/#sec-binaryand
8
9module.exports = function BinaryAnd(x, y) {
10 if ((x !== 0 && x !== 1) || (y !== 0 && y !== 1)) {
11 throw new $TypeError('Assertion failed: `x` and `y` must be either 0 or 1');
12 }
13 return x & y;
14};