mirror of
https://github.com/voson-wang/toon.git
synced 2026-01-29 23:34:10 +08:00
feat: decode method (#10)
This commit is contained in:
38
src/types.ts
38
src/types.ts
@@ -36,4 +36,42 @@ export type ResolvedEncodeOptions = Readonly<Required<EncodeOptions>>
|
||||
|
||||
// #endregion
|
||||
|
||||
// #region Decoder options
|
||||
|
||||
export interface DecodeOptions {
|
||||
/**
|
||||
* Number of spaces per indentation level.
|
||||
* @default 2
|
||||
*/
|
||||
indent?: number
|
||||
/**
|
||||
* When true, enforce strict validation of array lengths and tabular row counts.
|
||||
* @default true
|
||||
*/
|
||||
strict?: boolean
|
||||
}
|
||||
|
||||
export type ResolvedDecodeOptions = Readonly<Required<DecodeOptions>>
|
||||
|
||||
// #endregion
|
||||
|
||||
// #region Decoder parsing types
|
||||
|
||||
export interface ArrayHeaderInfo {
|
||||
key?: string
|
||||
length: number
|
||||
delimiter: Delimiter
|
||||
fields?: string[]
|
||||
hasLengthMarker: boolean
|
||||
}
|
||||
|
||||
export interface ParsedLine {
|
||||
raw: string
|
||||
depth: Depth
|
||||
indent: number
|
||||
content: string
|
||||
}
|
||||
|
||||
// #endregion
|
||||
|
||||
export type Depth = number
|
||||
|
||||
Reference in New Issue
Block a user