CoolFace
Apppublic

strong-tie/inbound-calls

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
index.js31 linesDownload Raw Back to lite
1var has = Object.prototype.hasOwnProperty;2 3function dequal(foo, bar) {4	var ctor, len;5	if (foo === bar) return true;6 7	if (foo && bar && (ctor=foo.constructor) === bar.constructor) {8		if (ctor === Date) return foo.getTime() === bar.getTime();9		if (ctor === RegExp) return foo.toString() === bar.toString();10 11		if (ctor === Array) {12			if ((len=foo.length) === bar.length) {13				while (len-- && dequal(foo[len], bar[len]));14			}15			return len === -1;16		}17 18		if (!ctor || typeof foo === 'object') {19			len = 0;20			for (ctor in foo) {21				if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;22				if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;23			}24			return Object.keys(bar).length === len;25		}26	}27 28	return foo !== foo && bar !== bar;29}30 31exports.dequal = dequal;