Little util function for simpler extracting Boolean values from ENV variables in Node.js.
JavaScript
Switch branches/tags
Nothing to show
Latest commit 2d9e33c Nov 29, 2013 @grimen Merge pull request #1 from bitdeli-chef/master
Add a Bitdeli Badge to README
Permalink
Failed to load latest commit information.
lib
test
.editorconfig
.gitattributes
.gitignore
.travis.yml Initial implementation. May 14, 2013
MIT-LICENSE Initial implementation. May 14, 2013
Makefile Initial implementation. May 14, 2013
README.md
index.js
package.json

README.md

NODE-ENV-FLAG Build Status

Little util function for simpler extracting Boolean values from ENV variables in Node.js, i.e. true values (true, TRUE, 1) vs. false values (false, FALSE, 0).

Example

  var DEFAULT_FOO = 1;

  var flag = require('node-env-flag');

  var yep = flag(process.env.FOO, DEFAULT_FOO);

  if (yep) {
    console.log("Foo!")
  }

API

  • (value)

    flag(process.env.FOO);
  • (value, default)

    flag(process.env.FOO, 1);

Installation

  $ npm install node-env-flag

Test

Local tests:

  $ make test

License

Released under the MIT license.

Copyright (c) Jonas Grimfelt

Bitdeli Badge