Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "compile"

Index

Type aliases

Functions

Type aliases

TemplateFunction

TemplateFunction: (data: object, config: EtaConfig, cb?: CallbackFn) => string

Type declaration

Functions

compile

  • Takes a template string and returns a template function that can be called with (data, config, [cb])

    Parameters

    • str: string

      The template string

    • Optional config: PartialConfig

      A custom configuration object (optional)

      Example

      let compiledFn = eta.compile("Hi <%= it.user %>")
      // function anonymous()
      let compiledFnStr = compiledFn.toString()
      // "function anonymous(it,E,cb\n) {\nvar tR='',include=E.include.bind(E),includeFile=E.includeFile.bind(E);tR+='Hi ';tR+=E.e(it.user);if(cb){cb(null,tR)} return tR\n}"

    Returns TemplateFunction

Generated using TypeDoc