Skip to content

Commit

Permalink
json: use toString for classes
Browse files Browse the repository at this point in the history
  • Loading branch information
hbbio committed Apr 10, 2024
1 parent 8aa2cbd commit 8a3c035
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/json.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Cell } from "./cell";
import { isObject } from "./cellify";

const errorCell = new Error("cell");

Expand Down Expand Up @@ -34,6 +35,8 @@ export const jsonStringify = <T>(
out += "null";
break;
}
// use toString for classes
if (!isObject(v)) out += JSON.stringify(v.toString());
out += "{";
let first = true;
// sort objects alphabetically
Expand Down

0 comments on commit 8a3c035

Please sign in to comment.