IsStrictlyEqual.js 429 B

12345678910111213141516
  1. 'use strict';
  2. var SameValueNonNumber = require('./SameValueNonNumber');
  3. var Type = require('./Type');
  4. var NumberEqual = require('./Number/equal');
  5. // https://262.ecma-international.org/14.0/#sec-isstrictlyequal
  6. module.exports = function IsStrictlyEqual(x, y) {
  7. var xType = Type(x);
  8. var yType = Type(y);
  9. if (xType !== yType) {
  10. return false;
  11. }
  12. return xType === 'Number' ? NumberEqual(x, y) : SameValueNonNumber(x, y);
  13. };