Define order of JSON.stringify operation

This commit is contained in:
Koen Vlaswinkel
2023-10-12 09:49:24 +02:00
parent cce5a989cf
commit 52e3a71f9c

View File

@@ -98,7 +98,11 @@ export function validateModeledMethods(
const seenModeledMethods = new Set<string>();
for (const modeledMethod of consideredModeledMethods) {
const canonicalModeledMethod = canonicalizeModeledMethod(modeledMethod);
const key = JSON.stringify(canonicalModeledMethod);
const key = JSON.stringify(
canonicalModeledMethod,
// This ensures the keys are always in the same order
Object.keys(canonicalModeledMethod).sort(),
);
if (seenModeledMethods.has(key)) {
result.push({