StrictEqualityComparison.js 361 B

1234567891011121314151617
  1. 'use strict';
  2. var Type = require('./Type');
  3. // https://262.ecma-international.org/5.1/#sec-11.9.6
  4. module.exports = function StrictEqualityComparison(x, y) {
  5. var xType = Type(x);
  6. var yType = Type(y);
  7. if (xType !== yType) {
  8. return false;
  9. }
  10. if (xType === 'Undefined' || xType === 'Null') {
  11. return true;
  12. }
  13. return x === y; // shortcut for steps 4-7
  14. };