This commit is contained in:
2016-11-20 17:41:26 +01:00
parent a869ee0d02
commit 450ee5162c
9 changed files with 124 additions and 3 deletions

29
ts/index.ts Normal file
View File

@ -0,0 +1,29 @@
import * as mustache from 'mustache'
/**
* class Tlt allows templates to be used with different sets of data
*/
export class Tlt {
templateString: string
/**
* constructor of class Tlt
*/
constructor(templateStringArg: string) {
this.templateString = templateStringArg
}
/**
* returns template string with data applied
*/
applyData(data: any): string {
return mustache.render(this.templateString, data)
}
/**
* set a new template string
*/
setTemplate(templateStringArg: string) {
this.templateString = templateStringArg
}
}