Skip to content

Commit

Permalink
add onBigInt
Browse files Browse the repository at this point in the history
  • Loading branch information
tylersayshi committed Sep 19, 2024
1 parent 7443026 commit 6932852
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ark/util/serialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export type SerializationOptions = {
onSymbol?: (value: symbol) => string
onFunction?: (value: Function) => string
onUndefined?: string
onBigInt?: (value: bigint) => string
}

export type Json = JsonObject | JsonArray
Expand Down Expand Up @@ -95,7 +96,7 @@ const _serialize = (
case "symbol":
return printableOpts.onSymbol(data as symbol)
case "bigint":
return `$ark.bigint-${data}`
return opts.onBigInt?.(data as bigint) ?? `$ark.bigint-${data}`
case "undefined":
return opts.onUndefined ?? "$ark.undefined"
default:
Expand Down

0 comments on commit 6932852

Please sign in to comment.