@ts-common/azure-js-dev-tools
Version:
Developer dependencies for TypeScript related projects
45 lines • 1.5 kB
TypeScript
/**
* A TextBuilder that can be used to build up a large string.
*/
export declare class TextBuilder {
private text;
constructor(text?: string);
/**
* Append the provided value to this TextBuilder's text.
* @param value The value to append.
*/
append(value: BuilderActions<TextBuilder>): TextBuilder;
appendLine(value?: BuilderActions<TextBuilder>): TextBuilder;
/**
* Get the text that this TextBuilder has been building.
*/
toString(): string;
}
export declare type BuilderActions<T> = string | ((builder: T) => void) | (undefined | string | ((builder: T) => void))[];
export interface TextElementBuilder {
/**
* Start the element.
*/
start(): void;
/**
* Add the provided content to this element.
* @param actions The content to add to the element.
*/
content(actions: BuilderActions<TextElementBuilder>): TextElementBuilder;
/**
* End the html element.
*/
end(): void;
/**
* Get the text that this TextElementBuilder has been building.
*/
toString(): string;
}
/**
* Create an element using the provided builder and actions.
* @param builder The builder to create.
* @param actions The actions to use to create the builder's element.
*/
export declare function create<T extends TextElementBuilder>(builder: T, actions?: BuilderActions<T>): string;
export declare function repeatText(text: string, count: number): string;
//# sourceMappingURL=textBuilder.d.ts.map