Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

410 B
Raw Blame
export function canonicalJson(value: unknown): string {
  if (value === undefined) return "";
  return JSON.stringify(value, (_k, v) => {
    if (!v || typeof v !== "object" || Array.isArray(v)) return v;
    return Object.fromEntries(
      Object.entries(v as Record<string, unknown>).sort(([a], [b]) => {
        if (a < b) return -1;
        if (a > b) return 1;
        return 0;
      }),
    );
  });
}