Skip to content

Commit

Permalink
fix: don't throw for undefined/null values fixes #78
Browse files Browse the repository at this point in the history
  • Loading branch information
nobrayner committed Aug 29, 2024
1 parent ee27dc7 commit 1058161
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const encode = (value: any, indent?: number | undefined) => {
return JSON.stringify(
value,
(key, value) => {
if (typeof value[BOXED_TYPE] === "string") {
if (typeof value?.[BOXED_TYPE] === "string") {
return { ...value, __boxed_type__: value[BOXED_TYPE] };
}
return value;
Expand Down

0 comments on commit 1058161

Please sign in to comment.