How to use the @msgpack/msgpack.ExtensionCodec function in @msgpack/msgpack

To help you get started, we’ve selected a few @msgpack/msgpack examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github neovim / node-client / packages / neovim / src / utils / transport.ts View on Github external
private initializeExtensionCodec() {
    const codec = new ExtensionCodec();

    Metadata.forEach(({ constructor }, id: number): void => {
      codec.register({
        type: id,
        encode: (input: any) => {
          if (input instanceof constructor) {
            return encode(input.data);
          }
          return null;
        },
        decode: data => {
          return new constructor({
            transport: this,
            client: this.client,
            data: decode(data),
          });

@msgpack/msgpack

MessagePack for ECMA-262/JavaScript/TypeScript

ISC
Latest version published 1 year ago

Package Health Score

59 / 100
Full package analysis