@tsed/json-mapper
Version:
Json mapper module for Ts.ED Framework
48 lines (47 loc) • 1.67 kB
TypeScript
/**
* Tiny utility used by the mapper compilers to build executable arrow functions as strings.
* It provides helpers for scoping, branching, and composing mapper fragments before `eval`.
*/
export declare class Writer {
static object: {
assign(...args: string[]): string;
};
protected _root?: Writer;
protected body: (string | Writer)[];
private _indent;
constructor(root?: Writer);
static indent(lines: string[]): string[];
static mapper(mapperId: string, key: string, options: string): string;
static mapperFrom(key: string, options: string): string;
static options(...args: string[]): string;
add(...lines: (undefined | string | Writer)[]): this;
arrow(...args: string[]): Writer;
build(): string[];
callMapper(id: string, key: string, ...options: string[]): this;
returnCallMapper(id: string, key: string, ...options: string[]): Writer;
const(name: string, line: string): this;
each(iterable: string, args?: string[]): Writer;
if(condition: string): IfWriter;
switch(input: string): SwitchWriter;
indent(indent: boolean): this;
new(indent?: boolean): Writer;
return(line: string): Writer;
root(): Writer;
set(left: string, right: string): this;
toString(): string;
}
declare class IfWriter extends Writer {
protected condition: string;
protected elseWriter?: Writer;
constructor(condition: string, root: Writer);
else(): Writer;
build(): string[];
}
declare class SwitchWriter extends Writer {
#private;
private input;
constructor(input: string);
case(condition: string): Writer;
build(): string[];
}
export {};