Comparing version 1.2.0 to 1.3.0
@@ -6,4 +6,4 @@ { | ||
"db": { | ||
"host": "localhost" | ||
"host": "red" | ||
} | ||
} |
16
index.js
@@ -106,3 +106,19 @@ 'use strict'; | ||
}); | ||
}, | ||
env: function(){ | ||
// @TODO | ||
}, | ||
defaults: function(obj, save){ | ||
for (let a in obj) { | ||
if(obj.hasOwnProperty(a)){ | ||
config[a] = obj[a]; | ||
} | ||
} | ||
if(save){ | ||
module.exports.save(); | ||
} | ||
}, | ||
save: function(){ | ||
fs.writeFileSync(currentPath, JSON.stringify(config, null, 4) + '\n', 'utf8'); | ||
} | ||
}; |
{ | ||
"name": "cz", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "A simple config utility for nodejs", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,4 +5,11 @@ 'use strict'; | ||
config.load(__dirname + '/config.json'); | ||
config.defaults({ | ||
db: { | ||
host: 'localhost' | ||
} | ||
}); | ||
config.args(true); | ||
// console.log(config.get()); | ||
console.log(config.get()); |
7429
139