envisor
v0.1.0
Published
Universal library for managing your environment variables
Downloads
5
Maintainers
Readme
envisor
Universal library for managing your environment variables
Environment variables are a set of dynamic named values that can affect the way running processes will behave on a computer. They are part of the environment in which a process runs
License
MIT
Installation:
npm install envisor --save-dev
Usage
For example you could use the following code:
var env = require('envisor');
env.set('foo', 1);
env.get('foo'); // 1
API
.set
Sets/retrieves an environment variable
Primitive values
var env = require('envisor');
env.set('foo', 1);
env.get('foo'); // 1
Object values
var env = require('envisor');
env.set('foo', { bar: 1});
env.get('foo).bar; // 1
Object key/values
var env = require('envisor');
env.set({ foo: 1 });
env.get('foo'); // 1
.has
Checks an environment variable
var env = require('envisor');
env.set('foo', 1);
env.has('foo'); // true
.use
Use you personal namespace
var env = require('envisor');
env.use('foo');
env.set('bar', 1);
env.get('foo'); // 1
process.env.foo_bar; // 1
.remove
Removes an environment variable
var env = require('envisor');
env.set('foo', 1);
env.remove('foo');
env.get('foo'); // ''
.all
Returns all environment variables
var env = require('envisor');
env.all(); // process.env
Tests
npm test
Links
Environment variables process.env
Task submitted by Alexander Abashkin