Giter Site home page Giter Site logo

task-registry-template-engine-lodash.js's Introduction

task-registry-template-engine-lodash npm

Build Status Code Climate Test Coverage downloads license

The lodash template engine.

Usage

var TemplateEngine  = require('task-registry-template-engine')
//register the lodash template engine
require('task-registry-template-engine-lodash')

var result = templateEngine.executeSync({
  template: 'hello ${user}!'
  , data: {user: 'Mikey'}
  , engine: 'Lodash' //optional, defaults to the first registered template engine.
}) // the result is 'hello Mikey!'

var lodashEngine = TemplateEngine 'Lodash'
result = lodashEngine.executeSync({
  template: 'hello ${user}!'
  , data: {user: 'Mikey'}
  , write: true //write the compiled template string to engine for later used.
})  // the result is 'hello Mikey!'

result = lodashEngine.executeSync({data: {user: 'Jacky'})
// the result is 'hello Jacky!'

API

templateEngine.executeSync(aOptions)/templateEngine.execute(aOptions, done)

  • arguments
    • aOptions (Object):
      • template (String): the template string
      • write (Boolean): write the template function(compiled from the template string) to the template engine. default to false.
      • data (Object): the data properties to replace.
      • escape (RegExp): # The HTML "escape" delimiter.
      • evaluate (RegExp): # The "evaluate" delimiter.
      • imports (Object): # An object to import into the template as free variables.
      • interpolate (RegExp): # The "interpolate" delimiter.
      • sourceURL (String): # The sourceURL of the template’s compiled source.
      • variable (String): # The data object variable name.
    • done Function(error, result): the result callback function for async execute.
  • returns (String): the rendered result string.

TODO

License

MIT

task-registry-template-engine-lodash.js's People

Contributors

snowyu avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.