New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

m_config

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

m_config

retrieve and set config from a flat JSON file

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

m_config

Dead simple config, read and save a javascript object from a file.

install

npm install m_config --save

usage

save

const config = require('m_config')('./config.json');

// save important config...
// save replaces the files contents
config.save({
	wrong: true
})

// saves file: config.json  with { wrong: true }

config.save({
	demo: '123',
	hi_ho_silver: true,
	herp_derp: false
});

// non destructive merging...
config.merge({ a: true })
      .merge({ b: false })
      .merge({ c: 'hi ho silver!' })
      .load(function (err, data) {
          if(!err) console.log(data);
       });

// file contents has been replaced with the above options.

load

// load saved config...

config.load(function (err, config) {
	if (!err) {
		console.log(typeof config); // 'object'
		console.log(config.demo);   // '123'
		console.log(config.wrong)   // undefined
	}
})

chainable to some extent!

config.save({
	should_not_see_me: 'yolo!!'
}).empty();

Keywords

config

FAQs

Package last updated on 13 Nov 2016

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