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

wild-config

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wild-config - npm Package Compare versions

Comparing version 1.3.2 to 1.3.3

63

index.js

@@ -26,2 +26,4 @@ /* eslint no-console: 0, global-require: 0 */

events.setMaxListeners(0);
module.exports = {};

@@ -197,2 +199,53 @@

delete argv._;
delete argv.config;
delete argv.c;
let walkConfig = (cParent, eParent) => {
Object.keys(eParent || {}).forEach(key => {
if (!(key in cParent)) {
return;
}
if (typeof cParent[key] === 'object') {
if (!cParent[key]) {
// null
return;
}
if (eParent[key] === 'object') {
if (!eParent[key]) {
// null
return;
}
if (Array.isArray(cParent[key])) {
if (Array.isArray(eParent[key])) {
return;
}
// convert to array
eParent[key] = eParent[key].trim().split(/\s*,\s*/);
return;
}
return walkConfig(cParent[key], eParent[key]);
}
}
let value = eParent[key];
if (typeof eParent[key] === 'number') {
cParent[key] = Number(cParent[key]);
} else if (typeof eParent[key] === 'boolean') {
if (!isNaN(value)) {
value = Number(value);
} else {
value = value.toLowerCase();
}
let falsy = ['false', 'null', 'undefined', 'no', '0', '', 0];
cParent[key] = falsy.includes(value) ? false : !!value;
} else {
cParent[key] = eParent[key];
}
});
};
walkConfig(data, argv);
// apply command line options

@@ -204,3 +257,5 @@ // only modifies keys that already exist

}
let value = argv[key];
let kPath = key

@@ -212,2 +267,4 @@ .replace(/\.+/g, '.')

console.log(kPath);
let ignore = false;

@@ -222,2 +279,4 @@ let parent = data;

parent = parent[k];
} else {
ignore = true;
}

@@ -228,2 +287,6 @@ });

}
console.log(parent);
console.log(eKey);
console.log(typeof parent[eKey]);
if (eKey in parent) {

@@ -230,0 +293,0 @@ if (typeof parent[eKey] === 'number' && !isNaN(value)) {

4

package.json
{
"name": "wild-config",
"version": "1.3.2",
"version": "1.3.3",
"description": "Configuration management module",

@@ -24,3 +24,3 @@ "main": "index.js",

"minimist": "^1.2.0",
"toml": "^2.3.2"
"toml": "^2.3.3"
},

@@ -27,0 +27,0 @@ "devDependencies": {

@@ -25,3 +25,3 @@ # wild-config

When using command line arguments to provide config values only such keys are merged that already exist in the configuration object, unknown keys are ignored. For subkeys use dot notation. Value type (numbers, booleans and strings are supported) is defined by existing value.
When using command line arguments to provide config values only such keys are merged that already exist in the configuration object. For subkeys use dot notation. Value type (numbers, booleans and strings are supported) is defined by existing value.

@@ -28,0 +28,0 @@ Example _config/default.toml_:

Sorry, the diff of this file is not supported yet

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