SameValueNonNumber.js 450 B

12345678910111213141516
  1. 'use strict';
  2. var GetIntrinsic = require('get-intrinsic');
  3. var $TypeError = GetIntrinsic('%TypeError%');
  4. var SameValue = require('./SameValue');
  5. // https://262.ecma-international.org/7.0/#sec-samevaluenonnumber
  6. module.exports = function SameValueNonNumber(x, y) {
  7. if (typeof x === 'number' || typeof x !== typeof y) {
  8. throw new $TypeError('SameValueNonNumber requires two non-number values of the same type.');
  9. }
  10. return SameValue(x, y);
  11. };