@notenoughupdates/discord-akairo
Advanced tools
Comparing version
{ | ||
"name": "@notenoughupdates/discord-akairo", | ||
"version": "9.0.10-dev.1640804207.c48216d", | ||
"version": "9.0.10-dev.1640804630.61aa536", | ||
"description": "A highly customizable bot framework for Discord.js.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/src/index.js", |
@@ -91,3 +91,2 @@ "use strict"; | ||
} | ||
/* eslint-disable no-console */ | ||
// eslint-disable-next-line complexity | ||
@@ -100,33 +99,11 @@ static deepEquals(a, b, options) { | ||
throw new TypeError("Not objects"); | ||
if ((Array.isArray(a) && !Array.isArray(b)) || (!Array.isArray(a) && Array.isArray(b))) { | ||
console.debug("deepEquals: Array vs non-array"); | ||
if ((Array.isArray(a) && !Array.isArray(b)) || (!Array.isArray(a) && Array.isArray(b))) | ||
return false; | ||
} | ||
const newA = ignoreArrayOrder && Array.isArray(a) && a.length && typeof a[0] === "string" | ||
? [...a].sort((aa, bb) => { | ||
if (aa < bb) | ||
return -1; | ||
if (aa > bb) | ||
return 1; | ||
return 0; | ||
}) | ||
: a; | ||
const newB = ignoreArrayOrder && Array.isArray(b) && b.length && typeof b[0] === "string" | ||
? [...b].sort((aa, bb) => { | ||
if (aa < bb) | ||
return -1; | ||
if (aa > bb) | ||
return 1; | ||
return 0; | ||
}) | ||
: b; | ||
const newA = ignoreArrayOrder && Array.isArray(a) && a.length && typeof a[0] !== "object" ? [...a].sort() : a; | ||
const newB = ignoreArrayOrder && Array.isArray(b) && b.length && typeof b[0] !== "object" ? [...b].sort() : b; | ||
for (const key in newA) { | ||
if (ignoreUndefined && newA[key] === undefined && newB[key] === undefined) | ||
continue; | ||
if (!(key in newB)) { | ||
console.log("======================================"); | ||
console.dir(newA, { depth: 4 }); | ||
console.dir(newB, { depth: 4 }); | ||
if (!(key in newB)) | ||
return false; | ||
} | ||
if (typeof newA[key] === "object" && typeof newB[key] === "object") { | ||
@@ -136,14 +113,7 @@ if (!this.deepEquals(newA[key], newB[key], { ignoreUndefined, ignoreArrayOrder })) | ||
} | ||
else if (newA[key] !== newB[key]) { | ||
console.log("======================================"); | ||
console.dir(newA[key], { depth: 4 }); | ||
console.dir(newA, { depth: 4 }); | ||
console.dir(newB[key], { depth: 4 }); | ||
console.dir(newB, { depth: 4 }); | ||
else if (newA[key] !== newB[key]) | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
/* eslint-enable no-console */ | ||
/** | ||
@@ -150,0 +120,0 @@ * Converts a string in snake_case to camelCase. |
{ | ||
"name": "@notenoughupdates/discord-akairo", | ||
"version": "9.0.10-dev.1640804207.c48216d", | ||
"version": "9.0.10-dev.1640804630.61aa536", | ||
"description": "A highly customizable bot framework for Discord.js.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/src/index.js", |
@@ -113,3 +113,2 @@ /* eslint-disable @typescript-eslint/ban-types */ | ||
public static deepEquals<T>(a: unknown, b: T, options?: DeepEqualsOptions): a is T; | ||
/* eslint-disable no-console */ | ||
// eslint-disable-next-line complexity | ||
@@ -121,44 +120,14 @@ public static deepEquals(a: any, b: any, options?: DeepEqualsOptions): boolean { | ||
if (typeof a !== "object" || typeof b !== "object") throw new TypeError("Not objects"); | ||
if ((Array.isArray(a) && !Array.isArray(b)) || (!Array.isArray(a) && Array.isArray(b))) { | ||
console.debug("deepEquals: Array vs non-array"); | ||
return false; | ||
} | ||
const newA = | ||
ignoreArrayOrder && Array.isArray(a) && a.length && typeof a[0] === "string" | ||
? [...a].sort((aa, bb) => { | ||
if (aa < bb) return -1; | ||
if (aa > bb) return 1; | ||
return 0; | ||
}) | ||
: a; | ||
const newB = | ||
ignoreArrayOrder && Array.isArray(b) && b.length && typeof b[0] === "string" | ||
? [...b].sort((aa, bb) => { | ||
if (aa < bb) return -1; | ||
if (aa > bb) return 1; | ||
return 0; | ||
}) | ||
: b; | ||
if ((Array.isArray(a) && !Array.isArray(b)) || (!Array.isArray(a) && Array.isArray(b))) return false; | ||
const newA = ignoreArrayOrder && Array.isArray(a) && a.length && typeof a[0] !== "object" ? [...a].sort() : a; | ||
const newB = ignoreArrayOrder && Array.isArray(b) && b.length && typeof b[0] !== "object" ? [...b].sort() : b; | ||
for (const key in newA) { | ||
if (ignoreUndefined && newA[key] === undefined && newB[key] === undefined) continue; | ||
if (!(key in newB)) { | ||
console.log("======================================"); | ||
console.dir(newA, { depth: 4 }); | ||
console.dir(newB, { depth: 4 }); | ||
return false; | ||
} | ||
if (!(key in newB)) return false; | ||
if (typeof newA[key] === "object" && typeof newB[key] === "object") { | ||
if (!this.deepEquals(newA[key], newB[key], { ignoreUndefined, ignoreArrayOrder })) return false; | ||
} else if (newA[key] !== newB[key]) { | ||
console.log("======================================"); | ||
console.dir(newA[key], { depth: 4 }); | ||
console.dir(newA, { depth: 4 }); | ||
console.dir(newB[key], { depth: 4 }); | ||
console.dir(newB, { depth: 4 }); | ||
return false; | ||
} | ||
} else if (newA[key] !== newB[key]) return false; | ||
} | ||
return true; | ||
} | ||
/* eslint-enable no-console */ | ||
@@ -165,0 +134,0 @@ /** |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
913185
-0.3%16382
-0.37%