Socket
Socket
Sign inDemoInstall

convict

Package Overview
Dependencies
Maintainers
9
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

convict - npm Package Compare versions

Comparing version 4.2.0 to 4.3.0

19

CHANGELOG.md

@@ -8,2 +8,21 @@ # Change Log

## [4.3.0] - 2018-06-02
### Fixed
- Allow argument value to be falsy #246 (Dan Allen @mojavelinux)
### Added
- Accept args and env as parameters to convict function #223 (Dan Allen @mojavelinux)
- Allow the default parser to be set #248 (Dan Allen @mojavelinux)
- Add package-lock.json file (Marc-Aurèle Darche @madarche)
### Changed
- Update deps (almost all) (Marc-Aurèle Darche @madarche)
### Removed
- Remove browserify package and configuration. This was never needed. (Marc-Aurèle Darche @madarche)
## [4.2.0] - 2018-03-23

@@ -10,0 +29,0 @@ ### Added

31

lib/convict.js

@@ -94,3 +94,3 @@ /**

const parsers_registry = {};
const parsers_registry = { '*': json5.parse };

@@ -330,7 +330,8 @@ const ALLOWED_OPTION_STRICT = 'strict';

function importEnvironment(o) {
const env = o.getEnv();
Object.keys(o._env).forEach(function(envStr) {
if (process.env[envStr] !== undefined) {
if (env[envStr] !== undefined) {
let ks = o._env[envStr];
ks.forEach(function(k) {
o.set(k, process.env[envStr]);
o.set(k, env[envStr]);
});

@@ -342,6 +343,6 @@ }

function importArguments(o) {
const argv = parseArgs(process.argv.slice(2));
const argv = parseArgs(o.getArgs());
Object.keys(o._argv).forEach(function(argStr) {
let k = o._argv[argStr];
if (argv[argStr]) {
if (argv[argStr] !== undefined) {
o.set(k, String(argv[argStr]));

@@ -446,3 +447,3 @@ }

const extension = segments.length > 1 ? segments.pop() : '';
const parse = parsers_registry[extension] || json5.parse;
const parse = parsers_registry[extension] || parsers_registry['*'];

@@ -476,3 +477,3 @@ // TODO Get rid of the sync call

*/
let convict = function convict(def) {
let convict = function convict(def, opts) {

@@ -483,2 +484,18 @@ // TODO: Rename this `rv` variable (supposedly "return value") into something

/**
* Gets the array of process arguments, using the override passed to the
* convict function or process.argv if no override was passed.
*/
getArgs: function() {
return (opts && opts.args) || process.argv.slice(2);
},
/**
* Gets the environment variable map, using the override passed to the
* convict function or process.env if no override was passed.
*/
getEnv: function() {
return (opts && opts.env) || process.env;
},
/**
* Exports all the properties (that is the keys and their current values) as JSON

@@ -485,0 +502,0 @@ */

@@ -13,3 +13,3 @@ {

],
"version": "4.2.0",
"version": "4.3.0",
"license": "Apache-2.0",

@@ -44,27 +44,19 @@ "homepage": "https://github.com/mozilla/node-convict",

"dependencies": {
"depd": "1.1.1",
"json5": "0.5.1",
"depd": "1.1.2",
"json5": "1.0.1",
"lodash.clonedeep": "4.5.0",
"moment": "2.19.3",
"moment": "2.22.2",
"validator": "7.2.0",
"yargs-parser": "7.0.0"
"yargs-parser": "10.0.0"
},
"devDependencies": {
"coveralls": "2.13.1",
"eslint": "4.6.1",
"coveralls": "3.0.1",
"eslint": "4.19.1",
"istanbul": "0.4.5",
"js-yaml": "^3.11.0",
"mocha": "3.5.3",
"mocha": "5.2.0",
"must": "0.13.4",
"obj_diff": "0.3.0",
"toml": "^2.3.3"
},
"browserify": {
"transform": [
"varify"
]
},
"optionalDependencies": {
"varify": "0.2.0"
}
}

@@ -257,4 +257,4 @@ # Node-convict

2. File (`config.loadFile()`)
3. Environment variables (only if `env` property is set)
4. Command line arguments (only if `arg` property is set)
3. Environment variables (only used when `env` property is set in schema; can be overridden using the `env` option of the convict function)
4. Command line arguments (only used when `arg` property is set in schema; can be overridden using the `args` option of the convict function)
5. Set and load calls (`config.set()` and `config.load()`)

@@ -429,3 +429,10 @@

### config.getArgs()
The array of process arguments (not including the launcher and application file arguments). Defaults to process.argv unless an override is specified using the args key of the second (options) argument of the convict function.
### config.getEnv()
The map of environment variables. Defaults to process.env unless an override is specified using the env key of the second argument (options) argument of the convict function.
## FAQ

@@ -432,0 +439,0 @@

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