1.0.1 • Published 7 years ago
configuration-store v1.0.1
configuration-store
Store configuration for cli tools!
Install
npm install --save configuration-store
Usage
var createConfig = require('./index')
/* create a config file */
var conf = createConfig({
filename: 'confstoretest'
})
/* get empty object */
var data = conf.get()
console.log('empty object:', data)
/* set a value */
data = conf.set('hi', 'how are you')
console.log('value of hi:', conf.get('hi')) // how are you
/* set an object as value */
data = conf.set('obj', { ok: 'this is cool', right: 'yeah!' })
console.log('value of obj:', conf.get('obj')) // { ok: 'this is cool', right: 'yeah!' }
/* delete a property using keypath dot notation */
data = conf.delete('obj.right')
console.log('value of obj after delete', conf.get('obj')) // { ok: 'this is cool' }
/* check if a property exists */
var exists = conf.has('obj.right')
console.log('does obj.right exist?', exists) // false
/* clear all data from conf */
data = conf.clear()
console.log('empty object again:', data) // {}
/* remove configuration file completely! */
conf.destroy()
Documentation
Examples
Contributing
Contributions are welcome! Please read the contributing guidelines first.
Conduct
It's important that this project contributes to a friendly, safe, and welcoming environment for all, particularly for folks that are historically underrepresented in technology. Read this project's code of conduct
Change log
Read about the changes to this project in CHANGELOG.md. The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
Contact
- chat – You can chat about this project at http://gitter.im/sethvincent/ask
- issues – Please open issues in the issues queue
- twitter – @sethdvincent
- email – Need in-depth support via paid contract? Send an email to sethvincent@gmail.com