UNPKG

aspargvs

Version:
56 lines (55 loc) 1.77 kB
export declare type ObjectPath = { key0: string; keys: (string | number)[]; }; export declare type ArrayPath = { key0: number; keys: (string | number)[]; }; export declare type Path = ObjectPath | ArrayPath; export declare type ArgValue = null | true | false | number | string | Record<string, never> | ArgValue[]; export declare type KeyValuePair = { type: 'keyValue'; value: ArgValue; }; export declare type BareKey = { type: 'bareKey'; }; export declare type Negation = { type: 'negation'; }; export declare type ArrayKey = { type: 'arrayKey'; }; export declare type ObjectKey = { type: 'objectKey'; }; export declare type KeyData = KeyValuePair | BareKey | Negation | ArrayKey | ObjectKey; export declare type ArraySubKey = { type: 'subKey'; data: KeyData; path: ArrayPath; }; export declare type ObjectSubKey = { type: 'subKey'; data: KeyData; path: ObjectPath; }; export declare type SubKey = ObjectSubKey | ArraySubKey; export declare type FullKey = { type: 'fullKey'; data: KeyData; path: ObjectPath; }; export declare type KeyedArgToken = FullKey | SubKey; export declare type BareValue = { type: 'bareValue'; value: ArgValue; }; export declare type ArgToken = KeyedArgToken | BareValue; export declare function isObjectPath(path: Path): path is ObjectPath; export declare function isArrayPath(path: Path): path is ArrayPath; export declare function isObjectSubKey(subKey: SubKey): subKey is ObjectSubKey; export declare function isArraySubKey(subKey: SubKey): subKey is ArraySubKey; export declare function isKeyedArgToken(token: ArgToken): token is KeyedArgToken; export declare function argToToken(arg: string): ArgToken;