parse, parseAll

This commit is contained in:
Tony Garnock-Jones 2023-05-12 11:26:06 +02:00
parent a167e97c00
commit 134de6989b
1 changed files with 9 additions and 0 deletions

View File

@ -6,6 +6,15 @@ import { Bytes } from './bytes';
import { KeyedDictionary, KeyedSet } from './dictionary';
import { Writer, WriterOptions, EmbeddedWriter, WriterState } from './writer';
import { fromJS } from './fromjs';
import { Reader, ReaderOptions } from './reader';
export function parse<T = GenericEmbedded>(buffer: string, options?: ReaderOptions<T>): Value<T> {
return new Reader<T>(buffer, options).next();
}
export function parseAll<T = GenericEmbedded>(buffer: string, options?: ReaderOptions<T>): Value<T>[] {
return new Reader<T>(buffer, options).readToEnd();
}
export const stringifyEmbeddedWrite: EmbeddedWriter<any> = {
write(s: WriterState, v: any): void {