| Leo Repp | 58b9f11 | 2021-11-22 11:57:47 +0100 | [diff] [blame^] | 1 | 'use strict'; |
| 2 | |||||
| 3 | var GetIntrinsic = require('get-intrinsic'); | ||||
| 4 | |||||
| 5 | var $TypeError = GetIntrinsic('%TypeError%'); | ||||
| 6 | |||||
| 7 | // https://262.ecma-international.org/11.0/#sec-binaryor | ||||
| 8 | |||||
| 9 | module.exports = function BinaryOr(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 | }; | ||||