1 |
|
2 |
|
3 | export interface ASTNode {
|
4 | type: 'root' | 'bracket';
|
5 | nodes: ASTNode[];
|
6 | stash: string[];
|
7 | }
|
8 |
|
9 | export interface State {
|
10 | input: string;
|
11 | separator: string;
|
12 | stack: ASTNode[];
|
13 | bos(): boolean;
|
14 | eos(): boolean;
|
15 | prev(): string;
|
16 | next(): string;
|
17 | }
|
18 |
|
19 | export interface Options {
|
20 | brackets?: { [key: string]: string } | boolean;
|
21 | quotes?: string[] | boolean;
|
22 | separator?: string;
|
23 | strict?: boolean;
|
24 | keep?(value: string, state: State): boolean;
|
25 | }
|
26 |
|
27 | type SplitFunc = (state: State) => boolean;
|
28 |
|
29 | declare function split(input: string, options?: Options | SplitFunc): string[];
|
30 | declare function split(input: string, options: Options, fn: SplitFunc): string[];
|
31 |
|
32 | export default split;
|