Skip to content

Commit d0f6c82

Browse files
authored
Merge pull request #7 from PredicateSystems/fix_json
fix stable json
2 parents f932c02 + 4d59f2f commit d0f6c82

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/provider.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,13 @@ function redactResource(action: string, resource: string): string {
203203
}
204204

205205
function stableJson(value: unknown): string {
206+
if (value === undefined || value === null) {
207+
return "null";
208+
}
206209
if (Array.isArray(value)) {
207210
return `[${value.map((v) => stableJson(v)).join(",")}]`;
208211
}
209-
if (value && typeof value === "object") {
212+
if (typeof value === "object") {
210213
const entries = Object.entries(value as Record<string, unknown>).sort(
211214
([a], [b]) => a.localeCompare(b),
212215
);

0 commit comments

Comments
 (0)