mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Allow MustacheWriter to be called as a function with the view as the parameter.
For example, the documentation for Mustache.js shows the following: var compiledTemplate = Mustache.compile(stringTemplate); var templateOutput = compiledTemplate(templateData);
This commit is contained in:
@@ -5,4 +5,7 @@ var output = Mustache.render("{{title}} spends {{calc}}", view);
|
||||
|
||||
var person;
|
||||
var template = "<h1>{{firstName}} {{lastName}}</h1>Blog: {{blogURL}}";
|
||||
var html = Mustache.to_html(template, person);
|
||||
var html = Mustache.to_html(template, person);
|
||||
|
||||
var writer = Mustache.compile(template);
|
||||
var writerOutput = writer(view);
|
||||
|
||||
Vendored
+2
@@ -24,6 +24,7 @@ interface MustacheContext {
|
||||
}
|
||||
|
||||
interface MustacheWriter {
|
||||
(view: any): string;
|
||||
clearCache();
|
||||
compile(template: string, tags);
|
||||
compilePartial(name, template, tags);
|
||||
@@ -42,6 +43,7 @@ interface MustacheStatic {
|
||||
|
||||
parse(template: string, tags);
|
||||
clearCache(): MustacheWriter;
|
||||
compile(template: string): MustacheWriter;
|
||||
compile(template: string, tags): MustacheWriter;
|
||||
compilePartial(name: string, template: string, tags): MustacheWriter;
|
||||
compileTokens(tokens, template: string): MustacheWriter;
|
||||
|
||||
Reference in New Issue
Block a user