mirror of
https://github.com/deunix-educ/PyQuest.git
synced 2026-11-25 08:19:44 +01:00
Add LevelLinter (static checks) and LevelChecker (execution checks) shared by tests and the future author editor
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
export function deepCompareStrict(a, b) {
|
||||
const typeofa = typeof a;
|
||||
if (typeofa !== typeof b) {
|
||||
return false;
|
||||
}
|
||||
if (Array.isArray(a)) {
|
||||
if (!Array.isArray(b)) {
|
||||
return false;
|
||||
}
|
||||
const length = a.length;
|
||||
if (length !== b.length) {
|
||||
return false;
|
||||
}
|
||||
for (let i = 0; i < length; i++) {
|
||||
if (!deepCompareStrict(a[i], b[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (typeofa === 'object') {
|
||||
if (!a || !b) {
|
||||
return a === b;
|
||||
}
|
||||
const aKeys = Object.keys(a);
|
||||
const bKeys = Object.keys(b);
|
||||
const length = aKeys.length;
|
||||
if (length !== bKeys.length) {
|
||||
return false;
|
||||
}
|
||||
for (const k of aKeys) {
|
||||
if (!deepCompareStrict(a[k], b[k])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return a === b;
|
||||
}
|
||||
Reference in New Issue
Block a user