Skip to content
a key/value parser support simple template
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.autod.conf
.autod.conf.js
.eslintignore
.eslintrc
.gitignore
.travis.yml
History.md
README.md
appveyor.yml
index.js
package.json

README.md

Zhi

a key/value parser support simple template

Build Status Coverage Status


Install

$ npm install zhi

Usage

You can use zhi resolve parameter of dependency.

var zhi = require('zhi');
zhi({
  a: '{{b}}/{{c}}',
  b: '123',
  c: '{{d}}',
  d: 'abc'
})

return

{
  a: '123/abc',
  b: '123',
  c: 'abc',
  d: 'abc'
}

You can change tagName with tagStart and tagEnd.

zhi(obj, {
  tagStart: '<%',
  tagEnd: '%>'
});

You can use extra data with mixin option

var options = {
  mixin: {
    'x': '1',
    'y': '2',
    'z': '3'
  }
};
zhi({
  a: '{{b}}/{{c}}',
  b: '{{x}}{{y}}{{z}}',
  c: '{{d}}',
  d: 'abc'
}, options);

return

{
  a: '123/abc',
  b: '123',
  c: 'abc',
  d: 'abc'
}

LISENCE

MIT

You can’t perform that action at this time.