Skip to content

Commit

Permalink
Style
Browse files Browse the repository at this point in the history
  • Loading branch information
jacoblee93 committed Aug 27, 2024
1 parent 2ee7b75 commit da70fd3
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions libs/checkpoint/src/serde/jsonplus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@ function isLangChainSerializedObject(value: Record<string, unknown>) {
const _serialize = (value: any, seen = new WeakSet()): string => {
const defaultValue = _default("", value);

if (defaultValue === null) return "null";
if (typeof defaultValue === "string") return JSON.stringify(defaultValue);
if (typeof defaultValue === "number" || typeof defaultValue === "boolean")
if (defaultValue === null) {
return "null";
} else if (typeof defaultValue === "string") {
return JSON.stringify(defaultValue);
} else if (
typeof defaultValue === "number" ||
typeof defaultValue === "boolean"
) {
return defaultValue.toString();
if (typeof defaultValue === "object") {
} else if (typeof defaultValue === "object") {
if (seen.has(defaultValue)) {
throw new TypeError("Circular reference detected");
}
Expand Down

0 comments on commit da70fd3

Please sign in to comment.