forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ejs.d.ts
91 lines (85 loc) · 3.85 KB
/
ejs.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// Type definitions for ejs.js v2.3.3
// Project: http://ejs.co/
// Definitions by: Ben Liddicott <https://github.com/benliddicott/DefinitelyTyped>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "ejs" {
namespace Ejs {
type Data = { [name: string]: any };
type Dependencies = string[];
var cache: Cache;
var localsName: string;
function resolveInclude(name: string, filename: string): string;
function compile(template: string, opts?: Options): (TemplateFunction);
function render(template: string, data?: Data, opts?: Options): string;
function renderFile(path: string, data?: Data, opts?: Options, cb?: Function): any;// TODO RenderFileCallback return type
function clearCache(): any;
function TemplateFunction(data: Data): any;
interface TemplateFunction {
dependencies: Dependencies;
}
interface Options {
cache?: any;
filename?: string;
context?: any;
compileDebug?: boolean;
client?: boolean;
delimiter?: string;
debug?: any;
_with?: boolean;
}
class Template {
constructor(text: string, opts: Options);
opts: Options;
templateText: string;
mode: string;
truncate: boolean;
currentLine: number;
source: string;
dependencies: Dependencies;
createRegex(): RegExp;
compile(): TemplateFunction;
generateSource(): any;
parseTemplateText(): string[];
scanLine(line: string): any;
}
module Template {
interface MODES {
EVAL: string;
ESCAPED: string;
RAW: string;
COMMENT: string;
LITERAL: string;
}
}
function escapeRegexChars(s: string): string;
function escapeXML(markup: string): string;
function shallowCopy<T1>(to: T1, fro: any): T1;
interface Cache {
_data: { [name: string]: any };
set(key: string, val: any): any;
get(key: string): any;
}
var cache: Cache;
function resolve(from1: string, to: string): string;
function resolve(from1: string, from2: string, to: string): string;
function resolve(from1: string, from2: string, from3: string, to: string): string;
function resolve(from1: string, from2: string, from3: string, from4: string, to: string): string;
function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, to: string): string;
function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, from6: string, to: string): string;
function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, from6: string, from7: string, to: string): string;
function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, from6: string, from7: string, from8: string, to: string): string;
function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, from6: string, from7: string, from8: string, from9: string, to: string): string;
function resolve(...args: string[]): string;
function normalize(path: string): string;
function isAbsolute(path: string): boolean;
function join(...args: string[]): string;
function relative(from: string, to: string): string;
var sep: string;
var delimiter: string;
function dirname(path: string): string;
function basename(path: string): string;
function extname(path: string): string;
function filter(xs: any, f: any): any; // TODO WHUT?
}
export = Ejs;
}