it
    Preparing search index...

    Interface ValueCodec<T>

    it-rpc uses a binary representation of values on the wire. By default it uses CBOR though it is not a requirement.

    Custom ValueCodecs can be used to extend the supported value types with application-specific types.

    interface ValueCodec<T = any> {
        type: number;
        canEncode(val: any): boolean;
        decode(
            buf: Uint8Array,
            codec: ValueCodecs,
            pushable: Pushable<Uint8Array<ArrayBufferLike>>,
            invocation: Invocation,
        ): T;
        encode(
            val: T,
            codec: ValueCodecs,
            context?: any,
            invocation?: Invocation,
        ): Uint8Array;
    }

    Type Parameters

    • T = any
    Index

    Properties

    Methods

    Properties

    type: number

    A unique number for the value type. It's recommended that user defined types use numbers greater than 1000 to avoid conflicting with built in value transformers

    Methods

    • Return true if this transformer can transform this value

      Parameters

      • val: any

      Returns boolean