Permalink
Cannot retrieve contributors at this time
31 lines (25 sloc)
802 Bytes
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
codeql-action/node_modules/dequal/lite/index.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var has = Object.prototype.hasOwnProperty; | |
function dequal(foo, bar) { | |
var ctor, len; | |
if (foo === bar) return true; | |
if (foo && bar && (ctor=foo.constructor) === bar.constructor) { | |
if (ctor === Date) return foo.getTime() === bar.getTime(); | |
if (ctor === RegExp) return foo.toString() === bar.toString(); | |
if (ctor === Array) { | |
if ((len=foo.length) === bar.length) { | |
while (len-- && dequal(foo[len], bar[len])); | |
} | |
return len === -1; | |
} | |
if (!ctor || typeof foo === 'object') { | |
len = 0; | |
for (ctor in foo) { | |
if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false; | |
if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false; | |
} | |
return Object.keys(bar).length === len; | |
} | |
} | |
return foo !== foo && bar !== bar; | |
} | |
exports.dequal = dequal; |