Function createObjectCodec

  • a high-order codec that helps to organize multiple codecs together into a single object

    Type Parameters

    • Shape extends ObjectCodecShape

    Parameters

    • codecShape: Shape

    Returns ObjectCodec<Shape>

    Example

    const codec = createObjectCodec({
    r: Uint8,
    g: Uint8,
    b: Uint8,
    });

    // { r: ArrayBuffer([0xff]), g: ArrayBuffer([0x00]), b: ArrayBuffer([0x00]) }
    codec.pack({ r: 255, g: 0, b: 0 });

Generated using TypeDoc