summaryrefslogtreecommitdiff
path: root/src/node_modules/es-abstract/2020/BinaryXor.js
blob: d86f1edf2d06f9f1ffd0329290090a4a81533e5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
'use strict';

var GetIntrinsic = require('../GetIntrinsic');

var $TypeError = GetIntrinsic('%TypeError%');

// https://tc39.es/ecma262/2020/#sec-binaryxor

module.exports = function BinaryXor(x, y) {
	if ((x !== 0 && x !== 1) || (y !== 0 && y !== 1)) {
		throw new $TypeError('Assertion failed: `x` and `y` must be either 0 or 1');
	}
	return x ^ y;
};