0.0.7 • Published 6 years ago

templist v0.0.7

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

The Templist

The templating specialist

Install

$ npm install templist

Usage

const templist = require('templist');
const myoutput = templist( AnyStringOrPOJO,
                          { variable : 'map' },
                          { OptionalMethods: function(inp){ return modify(inp) } });

What it can do

templist('hello {{whois}}', { whois : "john" }) --> 'hello john'
templist('hello {{whois.firstname}}', { whois : { firstname: "john" } }) --> 'hello john'
templist({ hello : "{{whois.firstname}}" }, { whois : { firstname: "john" } }) --> { hello : "john" }
templist({ "{{greet}}" : "{{whois.firstname}}" }, { greet : "hello", whois : { firstname: "john" } })
      --> { hello : "john" }
templist({ "{{greet}}" : "{{whois}}" }, { greet : "hello", whois : { firstname: 'john' } })
      --> { hello : { firstname: 'john' } }
templist({ "{{greet}}" : { @ : 'getName' } }, { greet : "hello" }, { getName : function(){ return 'john' } })
      --> { hello : 'john' }

//via calls () fashion
templist({"gb{{1}}{{bm}}{{func(1,{{0}})}}":{"@":"func","params":true}},[3,9], {func:function(a,b){ return a+b; }})
    ---> {'gb9{{bm}}4': '3,9[object Object]'}

Want more example?

See test file.

License

Templist is released under the MIT license:

http://www.opensource.org/licenses/MIT

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago

0.0.0

7 years ago