@triviality/core
Version:
Purely typed service container
60 lines (59 loc) • 2.13 kB
TypeScript
/// <reference types="ts-toolbelt" />
export declare const generateRecurringString: import("Function/Curry").Curry<(total: number, empty: boolean, createString: (nr: number) => string, separator: string) => string>;
export declare const parseNumber: (str: string) => number;
/**
* Return all generators of a single document.
*
* Generators need to be inside multi-doc block comment.
*/
export declare const findAnnotationsString: (annotation: string) => (document: string) => string[];
/**
* Return all generators of a single document.
*
* Generators need to be inside multi-doc block comment.
*/
export declare const findFunctionGeneratorAnnotationsString: (document: string) => string[];
interface GeneratorTemplate {
length: number;
empty: boolean;
templates: string[];
removeNextLines: RegExp;
}
/**
* Remove any doc block characters from a string
*
* //
*
* /**
* *
* * /
*/
export declare const stripDocBlock: (str: string) => string;
/**
* Parse generator function.
*
* @typeGenerator({ length: 10, templates: ["services<{K% extends keyof T}>({t%: K%}): [{T[K%]}];"], removeNextLines: /; *$/ })
*/
export declare const parseFunctionGeneratorAnnotation: (template: string) => GeneratorTemplate;
/**
* Find all tags "{t%: K%}" of a function template.
*/
export declare const findGeneratorTagsStrings: (template: string) => string[];
interface GeneratorTag {
tag: string;
template: string;
separator: string;
}
/**
* Parse a single tag and return variables.
*/
export declare const parseGeneratorTag: (tag: string) => GeneratorTag;
export declare const findGeneratorTags: (template: string) => GeneratorTag[];
export declare const generateFunction: import("Function/Curry").Curry<(template: string, i: number) => string>;
export declare function generateFunctions(length: number, emptyArgs: boolean, templates: string[]): string;
export declare function generateFunctionsInDocument(document: string): string;
/**
* Replaces multiple generators of set of files.
*/
export declare function generateFunctionsOfTemplatesInDirectory(...directories: string[]): void;
export {};