Function: bigIntReviver()
bigIntReviver(
_key:string,value:unknown):unknown
Defined in: utils.ts:258
JSON reviver function that converts numeric strings back to BigInt.
Parameters
| Parameter | Type | Description |
|---|---|---|
_key | string | Property key (unused). |
value | unknown | Value to transform. |
Returns
unknown
BigInt if numeric string, otherwise unchanged value.
Example
TypeScript
import { bigIntReviver } from '@chainlink/ccip-sdk'
const json = '{"amount":"1000000000000000000"}'
const data = JSON.parse(json, bigIntReviver)
console.log(typeof data.amount) // 'bigint'
See
bigIntReplacer - Stringify BigInt values