0.1.2 • Published 6 years ago
homeconfjs v0.1.2
HomeConf
Global config files for cli apps helper
Table of Contents
Installation
npm install --save homeconfjsUsage
The file will be created automatically, named packageName.json
at the path homeConf.path that may varies depending on the current OS.
const HomeConf = require('homeconfjs');
const homeConf = new HomeConf(); // Default: {}Or
const HomeConf = require('homeconfjs');
const homeConf = new HomeConf({defaultObject}); // Specify the default objectOr
const HomeConf = require('homeconfjs');
const homeConf = new HomeConf(`${__dirname}/default.json`); // Use the file as defaultAPI
config
Get the actual config object.
homeConf.configpath
Get the path of the config file
homeConf.pathget('objectPath')
Get a value by its object path.
homeConf.get('user.name')set('objectPath', value)
Set and save a value by its object path.
homeConf.get('user.name', 'Anas')License
This project is under the MIT license.