cborkit
Version:
A modern, extensible CBOR (Concise Binary Object Representation) library for TypeScript and JavaScript.
25 lines (22 loc) • 733 B
TypeScript
import { c as CborItem } from './types-UHBEKmQx.js';
import { W as Writer } from './writer-B9qtRVNe.js';
type TypeofMapping = {
number: number;
bigint: bigint;
string: string;
boolean: boolean;
undefined: undefined;
object: object | null;
symbol: symbol;
function: Function;
};
type EncoderFn<T = unknown> = (value: T, next: () => CborItem, encode: (value: unknown) => CborItem) => CborItem;
type Encoder = {
[Key in keyof TypeofMapping]?: EncoderFn<TypeofMapping[Key]>;
};
type EncodeOptions = {
encoders?: Encoder[];
writer?: Writer;
};
declare const encode: (value: unknown, options?: EncodeOptions) => Uint8Array;
export { type EncodeOptions, type Encoder, type EncoderFn, encode };