Skip to content

Commit b47dd50

Browse files
committed
fix: prefer JSON.stringify
1 parent e170c9a commit b47dd50

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/utilities/stringify.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ const safeStringify = configure({
1515
});
1616

1717
export const stringify = (value: unknown): string => {
18+
try {
19+
return JSON.stringify(value) ?? '';
20+
} catch {
21+
// Swallow the error and try with safe-stable-stringify
22+
}
23+
1824
try {
1925
return safeStringify(value) ?? '';
2026
} catch (error) {

0 commit comments

Comments
 (0)