Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/popomore/zhi
a key/value parser support simple template
https://github.com/popomore/zhi
Last synced: about 2 months ago
JSON representation
a key/value parser support simple template
- Host: GitHub
- URL: https://github.com/popomore/zhi
- Owner: popomore
- Created: 2014-03-06T15:05:32.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2017-09-08T06:24:01.000Z (over 7 years ago)
- Last Synced: 2024-10-16T05:21:09.242Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 10.7 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
Awesome Lists containing this project
README
# Zhi
a key/value parser support simple template
[![Build Status](https://travis-ci.org/popomore/zhi.png?branch=master)](https://travis-ci.org/popomore/zhi)
[![Coverage Status](https://coveralls.io/repos/popomore/zhi/badge.png?branch=master)](https://coveralls.io/r/popomore/zhi?branch=master)---
## 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