New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

better-config

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

better-config

Config loader and defaults manager

  • 1.2.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Simple Config Library

npm package

Build status Dependency Status Known Vulnerabilities Gitter

This is a simple config library for use in NodeJS. Get started with:

npm install --save better-config

Usage

var config = require('better-config');

Here are the ways to set the config - For a big project you probably want to set the defaults, then set a config.json file (if they have one). If there is no file, the set call does nothing.

// Plain vanilla object setting
config.message = 'hello world';

// Set using the set function
config.set({ message: 'this is the default value' });

// Set using a json file
config.set('./package.json');

// Set using a js file
config.set('./defaults.js');

// Set using a function
config.set(function () {
  return { sum: 1+1 }
});

You can simply access the config like you would any other object:

// Plain vanilla object get
console.log(config.message)

// Get by function
console.log(config.get('some.deep.array[0].property'))

Contributions welcome!

Credits

This library was initially made by the awesome team of engineers at Diamond.

If you haven't already, make sure you install Diamond!

Keywords

FAQs

Package last updated on 09 Oct 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc