mirror of
https://github.com/nodejs/node.git
synced 2025-05-13 08:56:32 +00:00

Update ESLint to v3.8.0. * Installed with `npm install --production` to avoid installing unnecessary dev files * Used `dmn -f clean` to further eliminate unneeded files PR-URL: https://github.com/nodejs/node/pull/9112 Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
35 lines
740 B
JavaScript
35 lines
740 B
JavaScript
'use strict';
|
|
|
|
module.exports = function equal(a, b) {
|
|
if (a === b) return true;
|
|
|
|
var arrA = Array.isArray(a)
|
|
, arrB = Array.isArray(b)
|
|
, i;
|
|
|
|
if (arrA && arrB) {
|
|
if (a.length != b.length) return false;
|
|
for (i = 0; i < a.length; i++)
|
|
if (!equal(a[i], b[i])) return false;
|
|
return true;
|
|
}
|
|
|
|
if (arrA != arrB) return false;
|
|
|
|
if (a && b && typeof a === 'object' && typeof b === 'object') {
|
|
var keys = Object.keys(a);
|
|
|
|
if (keys.length !== Object.keys(b).length) return false;
|
|
|
|
for (i = 0; i < keys.length; i++)
|
|
if (b[keys[i]] === undefined) return false;
|
|
|
|
for (i = 0; i < keys.length; i++)
|
|
if(!equal(a[keys[i]], b[keys[i]])) return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
};
|