Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

confilter

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

confilter

Filter-driven configuration

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
Maintainers
1
Weekly downloads
 
Created
Source

Confilter

Load and transform configuration files using chains of recycleable filters:

Build Status Coverage Status

var confilter = require('confilter');

var config = confilter([
  confilter.loadJSON([
    './config.' + process.env.NODE_ENV + '.json',
    './config.json'
  ]),

  confilter.defaults({
    role: 'api',
    port: 3200
  }),
]);

Custom Filters

Custom filters are functions that accept and return the config object. A silly example from the test suite will multiply any numeric config values by two:

function timesTwoFilter (config) {
  Object.keys(config).forEach(function (k) {
    if (typeof config[k] === 'number') config[k] *= 2;
  });
  return config;
}

This filter can then be used like any other:

var config = confilter([

  confilter.loadJSON([
    './config.json'
  ]),

  timesTwoFilter
]);

Installation

$ npm install confilter

Test

Lint and run test suite:

$ npm test

Generate code coverage report:

$ npm run cover

License

MIT

Keywords

FAQs

Package last updated on 03 Dec 2014

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