mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 12:56:46 +08:00
For example, the documentation for Mustache.js shows the following: var compiledTemplate = Mustache.compile(stringTemplate); var templateOutput = compiledTemplate(templateData);
12 lines
388 B
TypeScript
12 lines
388 B
TypeScript
/// <reference path="mustache.d.ts" />
|
|
|
|
var view = { title: "Joe", calc: function () { return 2 + 4; } };
|
|
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 writer = Mustache.compile(template);
|
|
var writerOutput = writer(view);
|