This repository has been archived on 2020-11-02. You can view files and clone it, but cannot push or open issues or pull requests.
TripSit_Suite/node_modules/@tokenizer/token/index.d.ts
2020-11-01 22:46:04 +00:00

30 lines
700 B
TypeScript

/**
* Read-only token
* See https://github.com/Borewit/strtok3 for more information
*/
export interface IGetToken<T> {
/**
* Length of encoded token in bytes
*/
len: number;
/**
* Decode value from buffer at offset
* @param buffer - Buffer to read the decoded value from
* @param offset - Decode offset
* @return Decoded value
*/
get(buffer: Buffer, offset: number): T;
}
export interface IToken<T> extends IGetToken<T> {
/**
* Encode value to buffer
* @param buffer - Buffer to write the encoded value to
* @param offset - Buffer write offset
* @param value - Value to decode of type T
*/
put(buffer: Buffer, offset: number, value: T): number
}