Socket
Socket
Sign inDemoInstall

aldo-config

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    aldo-config

Configuration service for Aldo applications


Version published
Weekly downloads
1
Maintainers
1
Install size
16.9 kB
Created
Weekly downloads
 

Readme

Source

Configuration store for Node.js applications.

Installing

npm add aldo-config

Testing

npm test

Usage

const Store = require('aldo-config')

// create a new store with initial values
const config = new Store({ foo: 'bar' })

console.log(config.get('foo'))
//=> 'bar'

config.set('awesome', true)
console.log(config.get('awesome'))
//=> true

// Use dot-notation to access nested properties
config.set('bar.baz', true)
console.log(config.get('bar'))
//=> {baz: true}

console.log(config.toJSON())
//=> { "foo": "bar", "awesome": true, "bar": { "baz": true } }

API

config.set(key, value)

Set an item.

config.get(key, [defaultValue])

Get an item, or defaultValue if undefined.

config.has(key)

Check if an item exists.

config.merge(values)

Merge old values with the new ones.

Will set plain values and merge objects and arrays.

config.enable(key)

Set an item value to true.

If the key points to an object, a property enabled will be added with true value.

config.enabled(key)

Check whether a key's value is truthy.

config.disable(key)

Set an item value to false.

If the key points to an object, a property enabled will be added with false value.

config.enabled(key)

Check whether a key's value is falsy.

License

MIT License

Keywords

FAQs

Last updated on 20 Mar 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc