-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
.DS_Store | ||
build/ | ||
node_modules/ | ||
coverage/ | ||
c/ | ||
dist/ | ||
types/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* There was originally just `TypeEncoder` so don't break types by renaming or not exporting | ||
*/ | ||
export type TagDecoder = import('./interface').TagDecoder; | ||
/** | ||
* Export the types that were present in the original manual cborg.d.ts | ||
*/ | ||
export type TypeEncoder = import('./interface').OptionalTypeEncoder; | ||
/** | ||
* Export the types that were present in the original manual cborg.d.ts | ||
*/ | ||
export type DecodeOptions = import('./interface').DecodeOptions; | ||
/** | ||
* Export the types that were present in the original manual cborg.d.ts | ||
*/ | ||
export type EncodeOptions = import('./interface').EncodeOptions; | ||
import { decode } from './lib/decode.js'; | ||
import { encode } from './lib/encode.js'; | ||
import { Token } from './lib/token.js'; | ||
import { Type } from './lib/token.js'; | ||
export { decode, encode, Token, Type }; | ||
//# sourceMappingURL=cborg.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export {}; | ||
//# sourceMappingURL=example.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { Token } from './lib/token'; | ||
import { Bl } from './lib/bl'; | ||
export type TokenOrNestedTokens = Token | Token[] | TokenOrNestedTokens[]; | ||
export interface Reference { | ||
parent: Reference | undefined; | ||
obj: object | any[]; | ||
includes(obj: object | any[]): boolean; | ||
} | ||
export type OptionalTypeEncoder = (data: any, typ: string, options: EncodeOptions, refStack?: Reference) => TokenOrNestedTokens | null; | ||
export type StrictTypeEncoder = (data: any, typ: string, options: EncodeOptions, refStack?: Reference) => TokenOrNestedTokens; | ||
export type TokenTypeEncoder = { | ||
(buf: Bl, token: Token, options?: EncodeOptions): void; | ||
compareTokens(t1: Token, t2: Token): number; | ||
encodedSize?(token: Token, options?: EncodeOptions): number; | ||
}; | ||
export type MapSorter = (e1: (Token | Token[])[], e2: (Token | Token[])[]) => number; | ||
export type QuickEncodeToken = (token: Token) => Uint8Array | undefined; | ||
export interface DecodeTokenizer { | ||
done(): boolean; | ||
next(): Token; | ||
} | ||
export type TagDecoder = (inner: any) => any; | ||
export interface DecodeOptions { | ||
allowIndefinite?: boolean; | ||
allowUndefined?: boolean; | ||
coerceUndefinedToNull?: boolean; | ||
allowInfinity?: boolean; | ||
allowNaN?: boolean; | ||
allowBigInt?: boolean; | ||
strict?: boolean; | ||
useMaps?: boolean; | ||
rejectDuplicateMapKeys?: boolean; | ||
retainStringBytes?: boolean; | ||
tags?: TagDecoder[]; | ||
tokenizer?: DecodeTokenizer; | ||
} | ||
export interface EncodeOptions { | ||
float64?: boolean; | ||
addBreakTokens?: boolean; | ||
mapSorter?: MapSorter; | ||
quickEncodeToken?: QuickEncodeToken; | ||
typeEncoders?: { | ||
[typeName: string]: OptionalTypeEncoder; | ||
}; | ||
} | ||
//# sourceMappingURL=interface.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/** | ||
* @typedef {import('./bl.js').Bl} Bl | ||
* @typedef {import('../interface').DecodeOptions} DecodeOptions | ||
*/ | ||
/** | ||
* @param {Uint8Array} data | ||
* @param {number} offset | ||
* @param {DecodeOptions} options | ||
* @returns {number} | ||
*/ | ||
export function readUint8(data: Uint8Array, offset: number, options: DecodeOptions): number; | ||
/** | ||
* @param {Uint8Array} data | ||
* @param {number} offset | ||
* @param {DecodeOptions} options | ||
* @returns {number} | ||
*/ | ||
export function readUint16(data: Uint8Array, offset: number, options: DecodeOptions): number; | ||
/** | ||
* @param {Uint8Array} data | ||
* @param {number} offset | ||
* @param {DecodeOptions} options | ||
* @returns {number} | ||
*/ | ||
export function readUint32(data: Uint8Array, offset: number, options: DecodeOptions): number; | ||
/** | ||
* @param {Uint8Array} data | ||
* @param {number} offset | ||
* @param {DecodeOptions} options | ||
* @returns {number|bigint} | ||
*/ | ||
export function readUint64(data: Uint8Array, offset: number, options: DecodeOptions): number | bigint; | ||
/** | ||
* @param {Uint8Array} data | ||
* @param {number} pos | ||
* @param {number} _minor | ||
* @param {DecodeOptions} options | ||
* @returns {Token} | ||
*/ | ||
export function decodeUint8(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; | ||
/** | ||
* @param {Uint8Array} data | ||
* @param {number} pos | ||
* @param {number} _minor | ||
* @param {DecodeOptions} options | ||
* @returns {Token} | ||
*/ | ||
export function decodeUint16(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; | ||
/** | ||
* @param {Uint8Array} data | ||
* @param {number} pos | ||
* @param {number} _minor | ||
* @param {DecodeOptions} options | ||
* @returns {Token} | ||
*/ | ||
export function decodeUint32(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; | ||
/** | ||
* @param {Uint8Array} data | ||
* @param {number} pos | ||
* @param {number} _minor | ||
* @param {DecodeOptions} options | ||
* @returns {Token} | ||
*/ | ||
export function decodeUint64(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; | ||
/** | ||
* @param {Bl} buf | ||
* @param {Token} token | ||
*/ | ||
export function encodeUint(buf: Bl, token: Token): void; | ||
export namespace encodeUint { | ||
/** | ||
* @param {Token} token | ||
* @returns {number} | ||
*/ | ||
function encodedSize(token: Token): number; | ||
/** | ||
* @param {Token} tok1 | ||
* @param {Token} tok2 | ||
* @returns {number} | ||
*/ | ||
function compareTokens(tok1: Token, tok2: Token): number; | ||
} | ||
/** | ||
* @param {Bl} buf | ||
* @param {number} major | ||
* @param {number|bigint} uint | ||
*/ | ||
export function encodeUintValue(buf: Bl, major: number, uint: number | bigint): void; | ||
export namespace encodeUintValue { | ||
/** | ||
* @param {number} uint | ||
* @returns {number} | ||
*/ | ||
function encodedSize(uint: number): number; | ||
} | ||
export const uintBoundaries: (number | bigint)[]; | ||
export type Bl = import('./bl.js').Bl; | ||
export type DecodeOptions = import('../interface').DecodeOptions; | ||
import { Token } from './token.js'; | ||
//# sourceMappingURL=0uint.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/** | ||
* @typedef {import('./bl.js').Bl} Bl | ||
* @typedef {import('../interface').DecodeOptions} DecodeOptions | ||
*/ | ||
/** | ||
* @param {Uint8Array} data | ||
* @param {number} pos | ||
* @param {number} _minor | ||
* @param {DecodeOptions} options | ||
* @returns {Token} | ||
*/ | ||
export function decodeNegint8(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; | ||
/** | ||
* @param {Uint8Array} data | ||
* @param {number} pos | ||
* @param {number} _minor | ||
* @param {DecodeOptions} options | ||
* @returns {Token} | ||
*/ | ||
export function decodeNegint16(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; | ||
/** | ||
* @param {Uint8Array} data | ||
* @param {number} pos | ||
* @param {number} _minor | ||
* @param {DecodeOptions} options | ||
* @returns {Token} | ||
*/ | ||
export function decodeNegint32(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; | ||
/** | ||
* @param {Uint8Array} data | ||
* @param {number} pos | ||
* @param {number} _minor | ||
* @param {DecodeOptions} options | ||
* @returns {Token} | ||
*/ | ||
export function decodeNegint64(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; | ||
/** | ||
* @param {Bl} buf | ||
* @param {Token} token | ||
*/ | ||
export function encodeNegint(buf: Bl, token: Token): void; | ||
export namespace encodeNegint { | ||
/** | ||
* @param {Token} token | ||
* @returns {number} | ||
*/ | ||
function encodedSize(token: Token): number; | ||
/** | ||
* @param {Token} tok1 | ||
* @param {Token} tok2 | ||
* @returns {number} | ||
*/ | ||
function compareTokens(tok1: Token, tok2: Token): number; | ||
} | ||
export type Bl = import('./bl.js').Bl; | ||
export type DecodeOptions = import('../interface').DecodeOptions; | ||
import { Token } from './token.js'; | ||
//# sourceMappingURL=1negint.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/** | ||
* @param {Uint8Array} data | ||
* @param {number} pos | ||
* @param {number} minor | ||
* @param {DecodeOptions} _options | ||
* @returns {Token} | ||
*/ | ||
export function decodeBytesCompact(data: Uint8Array, pos: number, minor: number, _options: DecodeOptions): Token; | ||
/** | ||
* @param {Uint8Array} data | ||
* @param {number} pos | ||
* @param {number} _minor | ||
* @param {DecodeOptions} options | ||
* @returns {Token} | ||
*/ | ||
export function decodeBytes8(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; | ||
/** | ||
* @param {Uint8Array} data | ||
* @param {number} pos | ||
* @param {number} _minor | ||
* @param {DecodeOptions} options | ||
* @returns {Token} | ||
*/ | ||
export function decodeBytes16(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; | ||
/** | ||
* @param {Uint8Array} data | ||
* @param {number} pos | ||
* @param {number} _minor | ||
* @param {DecodeOptions} options | ||
* @returns {Token} | ||
*/ | ||
export function decodeBytes32(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; | ||
/** | ||
* @param {Uint8Array} data | ||
* @param {number} pos | ||
* @param {number} _minor | ||
* @param {DecodeOptions} options | ||
* @returns {Token} | ||
*/ | ||
export function decodeBytes64(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; | ||
/** | ||
* @param {Bl} buf | ||
* @param {Token} token | ||
*/ | ||
export function encodeBytes(buf: Bl, token: Token): void; | ||
export namespace encodeBytes { | ||
/** | ||
* @param {Token} token | ||
* @returns {number} | ||
*/ | ||
function encodedSize(token: Token): number; | ||
/** | ||
* @param {Token} tok1 | ||
* @param {Token} tok2 | ||
* @returns {number} | ||
*/ | ||
function compareTokens(tok1: Token, tok2: Token): number; | ||
} | ||
/** | ||
* @param {Uint8Array} b1 | ||
* @param {Uint8Array} b2 | ||
* @returns {number} | ||
*/ | ||
export function compareBytes(b1: Uint8Array, b2: Uint8Array): number; | ||
export type Bl = import('./bl.js').Bl; | ||
export type DecodeOptions = import('../interface').DecodeOptions; | ||
import { Token } from './token.js'; | ||
//# sourceMappingURL=2bytes.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* @param {Uint8Array} data | ||
* @param {number} pos | ||
* @param {number} minor | ||
* @param {DecodeOptions} options | ||
* @returns {Token} | ||
*/ | ||
export function decodeStringCompact(data: Uint8Array, pos: number, minor: number, options: DecodeOptions): Token; | ||
/** | ||
* @param {Uint8Array} data | ||
* @param {number} pos | ||
* @param {number} _minor | ||
* @param {DecodeOptions} options | ||
* @returns {Token} | ||
*/ | ||
export function decodeString8(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; | ||
/** | ||
* @param {Uint8Array} data | ||
* @param {number} pos | ||
* @param {number} _minor | ||
* @param {DecodeOptions} options | ||
* @returns {Token} | ||
*/ | ||
export function decodeString16(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; | ||
/** | ||
* @param {Uint8Array} data | ||
* @param {number} pos | ||
* @param {number} _minor | ||
* @param {DecodeOptions} options | ||
* @returns {Token} | ||
*/ | ||
export function decodeString32(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; | ||
/** | ||
* @param {Uint8Array} data | ||
* @param {number} pos | ||
* @param {number} _minor | ||
* @param {DecodeOptions} options | ||
* @returns {Token} | ||
*/ | ||
export function decodeString64(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; | ||
export const encodeString: typeof encodeBytes; | ||
export type Bl = import('./bl.js').Bl; | ||
export type DecodeOptions = import('../interface').DecodeOptions; | ||
import { Token } from './token.js'; | ||
import { encodeBytes } from './2bytes.js'; | ||
//# sourceMappingURL=3string.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.