@azhder/enver

0.0.3 • Public • Published

Enver

A wrapper for the dotenv package that can return defaults when values are missing.

const enver$ = require('@azhder/enver');
const {list, val, get, set$, del$} = enver$;

// for bulk configuration
enver$({
    port:  ['PORT', 4000],
    DEBUG: false,
    env:   ['NODE_ENV', 'dev']
});

console.log(val('port'), val('env'));   // 4000 prod
console.log(get('nope', 'yep'));        // nope
console.log(set$('nope', 'nope'));      // { name: 'nope', defaultValue: 'nope' }
console.log(del$('nope'));              // true


console.log(list()); // prints:

// {
//     port: { name: 'PORT', defaultValue: 4000 },
//     DEBUG: { name: 'DEBUG', defaultValue: false },
//     env: { name: 'NODE_ENV', defaultValue: 'dev' }
// }

Readme

Keywords

none

Package Sidebar

Install

npm i @azhder/enver

Weekly Downloads

3

Version

0.0.3

License

MIT

Unpacked Size

12.3 kB

Total Files

23

Last publish

Collaborators

  • azder