Cashu-TS - v4.5.1
    Preparing search index...

    Interface JSONIntApi

    interface JSONIntApi {
        parse(
            source: string,
            reviver?: (this: unknown, key: string, value: unknown) => unknown,
            options?: { fallbackTo?: "string" | "number" | "error"; strict?: boolean },
        ): unknown;
        stringify(
            value: unknown,
            replacer?:
                | ((this: unknown, key: string, value: unknown) => unknown)
                | readonly (string | number)[],
            space?: string | number,
        ): string | undefined;
    }
    Index

    Methods

    • Bigint aware JSON parser.

      Parameters

      • source: string
      • Optionalreviver: (this: unknown, key: string, value: unknown) => unknown
      • Optionaloptions: { fallbackTo?: "string" | "number" | "error"; strict?: boolean }

      Returns unknown

      Returns unknown, so validate or cast the result to an application-specific type.

      Unquoted JSON number tokens are parsed to BigInt when outside the safe integer range, otherwise to number.

    • BigInt aware JSON stringify.

      Parameters

      • value: unknown
      • Optionalreplacer:
            | ((this: unknown, key: string, value: unknown) => unknown)
            | readonly (string | number)[]
      • Optionalspace: string | number

      Returns string | undefined

      • BigInt is stringified as an unquoted JSON number token.
      • Parsing the result may yield number or bigint depending on the value and parse options.
      • Returns undefined for top-level values that JSON cannot represent, matching JSON.stringify behavior.