| 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 | var SameValue = require('./SameValue'); |
| 8 | var Type = require('./Type'); |
| 9 | |
| 10 | // https://262.ecma-international.org/11.0/#sec-samevaluenonnumeric |
| 11 | |
| 12 | module.exports = function SameValueNonNumeric(x, y) { |
| 13 | var xType = Type(x); |
| 14 | if (xType === 'Number' || xType === 'Bigint') { |
| 15 | throw new $TypeError('Assertion failed: SameValueNonNumeric does not accept Number or BigInt values'); |
| 16 | } |
| 17 | if (xType !== Type(y)) { |
| 18 | throw new $TypeError('SameValueNonNumeric requires two non-numeric values of the same type.'); |
| 19 | } |
| 20 | return SameValue(x, y); |
| 21 | }; |