BVB Source Codes

reactide Show equal.js Source code

Return Download reactide: download equal.js Source code - Download reactide Source code - Type:.js
  1. 'use strict';
  2.  
  3. /*eslint complexity: 0*/
  4.  
  5. module.exports = function equal(a, b) {
  6.   if (a === b) return true;
  7.  
  8.   var arrA = Array.isArray(a)
  9.     , arrB = Array.isArray(b)
  10.     , i;
  11.  
  12.   if (arrA && arrB) {
  13.     if (a.length != b.length) return false;
  14.     for (i = 0; i < a.length; i++)
  15.       if (!equal(a[i], b[i])) return false;
  16.     return true;
  17.   }
  18.  
  19.   if (arrA != arrB) return false;
  20.  
  21.   if (a && b && typeof a === 'object' && typeof b === 'object') {
  22.     var keys = Object.keys(a);
  23.     if (keys.length !== Object.keys(b).length) return false;
  24.  
  25.     var dateA = a instanceof Date
  26.       , dateB = b instanceof Date;
  27.     if (dateA && dateB) return a.getTime() == b.getTime();
  28.     if (dateA != dateB) return false;
  29.  
  30.     var regexpA = a instanceof RegExp
  31.       , regexpB = b instanceof RegExp;
  32.     if (regexpA && regexpB) return a.toString() == b.toString();
  33.     if (regexpA != regexpB) return false;
  34.  
  35.     for (i = 0; i < keys.length; i++)
  36.       if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
  37.  
  38.     for (i = 0; i < keys.length; i++)
  39.       if(!equal(a[keys[i]], b[keys[i]])) return false;
  40.  
  41.     return true;
  42.   }
  43.  
  44.   return false;
  45. };
  46.  
downloadequal.js Source code - Download reactide Source code
Related Source Codes/Software:
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
postal - 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top