@xesam/config
v0.0.3
Published
a simple json config loader
Downloads
2
Readme
Config
a simple json config loader.
usage
npm install @xesam/config
test data
{
key_1: 'val_1',
key_2: {
key_2_1: {
key_2_1_1: 'val_2_1_1'
},
key_2_2: 'val_2_2'
}
}
load config
search path:
- absolute path
- working dir
- home dir
- source dir
const cfg = new Config('config.demo.json5');
const c = cfg.loadSync("key_2", "key_2_1");
console.log(c) // {key_2_1_1: 'val_2_1_1'}
dump config
const cfg = new Config('config.demo.json5');
cfg.dump({ val: 200 }).then(() => {
...
});