@xo-cash/utils
    Preparing search index...

    Function extendedJsonReplacer

    • The JSON replacer that encodes bigint and Uint8Array values in Extended JSON format, compatible with the format expected by extendedJsonReviver.

      • BigInts are encoded as <bigint: 123n>.
      • Uint8Arrays are encoded as <uint8array: abcd>. All other values pass through unchanged and if any incompatible type is encountered, an error is thrown.

      Note: To use this function, pass it as the second argument to JSON.stringify when serializing data.

      Note to developers: Libauth's stringify is the replacer. It also serializes functions and symbols, which we do not support. Passing it would let templates include those values, but revival would then fail. This module provides a dedicated replacer and reviver so serialization and deserialization stay aligned.

      Parameters

      • _propertyKey: string

        The property key being serialized, required by the JSON.stringify replacer but not used here.

      • value: unknown

        The value to encode or pass through unchanged.

      Returns unknown

      The encoded string