All files / json-pack/src/msgpack util.ts

86.66% Statements 13/15
100% Branches 0/0
33.33% Functions 1/3
100% Lines 9/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 151x 1x 1x     1x 1x 1x   1x 6x 1x      
import {MsgPackEncoderFast} from './MsgPackEncoderFast';
import {MsgPackEncoder} from './MsgPackEncoder';
import {MsgPackDecoderFast} from './MsgPackDecoderFast';
import type {MsgPack} from './types';
 
export const encoder = new MsgPackEncoderFast();
export const encoderFull = new MsgPackEncoder();
export const decoder = new MsgPackDecoderFast();
 
export const encode = <T>(data: T): MsgPack<T> => encoder.encode(data) as MsgPack<T>;
export const encodeFull = <T>(data: T): MsgPack<T> => encoderFull.encode(data) as MsgPack<T>;
export const decode = <T>(blob: MsgPack<T>): T => decoder.decode(blob) as T;
 
export type {MsgPack};