UNPKG

@jsonjoy.com/json-type

Version:

High-performance JSON Pointer implementation

23 lines (22 loc) 780 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getEncoder = void 0; const CborCodegen_1 = require("./cbor/CborCodegen"); const JsonCodegen_1 = require("./json/JsonCodegen"); const MsgPackCodegen_1 = require("./msgpack/MsgPackCodegen"); const getEncoder = (codec, type) => { switch (codec.format) { case 0 /* EncodingFormat.Cbor */: { return CborCodegen_1.CborCodegen.get(type); } case 1 /* EncodingFormat.MsgPack */: { return MsgPackCodegen_1.MsgPackCodegen.get(type); } case 2 /* EncodingFormat.Json */: { return JsonCodegen_1.JsonCodegen.get(type); } default: throw new Error('UNK_CODEC'); } }; exports.getEncoder = getEncoder;