Using $.template() like _.template()
npm install dollar.template
Use $.template() like _.template(), compiles JavaScript templates into functions that can be evaluated for rendering.
Code copied from Underscore.js, just renamed _.template to $.template, and exports some dependency methods to $. You can use it as a jQuery or Zepto plugin, or use directly in Node.js.
```
npm install dollar.template
``
bower install dollar.template
`javascript
var template = require('dollar.template').template;
var compiled = template("hello: <%= name %>");
compiled({name: 'moe'}); // "hello: moe"
var tmpl = template("<%- value %>");
tmpl({value: '
`
`javascript`
var compiled = $.template("hello: <%= name %>");
compiled({name: 'moe'}); // "hello: moe"
`html`
``
npm test
- $.isObject - $.isObject({}); => true$.keys({one: 1, two: 2, three: 3});
- $.keys - => ["one", "two", "three"]$.invert({Moe: "Moses", Larry: "Louis", Curly: "Jerome"});
- $.allkeys - See _.allkeys
- $.invert - => {Moses: "Moe", Louis: "Larry", Jerome: "Curly"};$.has({a: 1, b: 2, c: 3}, "b");
- $.has - => true$.escape('Curly, Larry & Moe');
- $.escape - => "Curly, Larry & Moe"$.unescape('Curly, Larry & Moe');
- $.unescape - => "Curly, Larry & Moe"`
- $.defaults - See _.defaults
- $.template - See _.template