blob: f7ef12c012eece7186e7efbed0808b79888a4e98 [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
7var SameValue = require('./SameValue');
8var Type = require('./Type');
9
10// https://262.ecma-international.org/11.0/#sec-samevaluenonnumeric
11
12module.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};