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

bcfg

Package Overview
Dependencies
Maintainers
3
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bcfg - npm Package Compare versions

Comparing version 0.1.7 to 0.1.8

.hs-tools/github/bcoin-org-bmocha-d1d35e3c61848c4067a7dbe5a1335c88a6894a2f-sha.json

70

lib/config.js

@@ -124,23 +124,27 @@ /*!

* Open a config file.
* @param {String} file - e.g. `bcoin.conf`.
* @param {String|String[]} file - e.g. `bcoin.conf`, or array of strings
* @throws on IO error
*/
open(file) {
open(files) {
if (fs.unsupported)
return;
const path = this.getFile(file);
files = !Array.isArray(files) ? [files] : files;
let text;
try {
text = fs.readFileSync(path, 'utf8');
} catch (e) {
if (e.code === 'ENOENT')
return;
throw e;
for (const file of files) {
const path = this.getFile(file);
let text;
try {
text = fs.readFileSync(path, 'utf8');
} catch (e) {
if (e.code === 'ENOENT')
continue;
throw e;
}
this.parseConfig(text);
}
this.parseConfig(text);
this.prefix = this.getPrefix();

@@ -152,8 +156,26 @@ }

* @param {String} name
* @param {Object} [inheritFiltered={}]
* @param {Boolean} [inheritFiltered.env=true]
* @param {Boolean} [inheritFiltered.args=true]
* @param {Boolean} [inheritFiltered.query=true]
* @param {Boolean} [inheritFiltered.hash=true]
* @param {Boolean} [inheritFiltered.options=true]
* @param {Boolean} [inheritFiltered.data=false]
* @returns {Config}
*/
filter(name) {
filter(name, inheritFiltered = {}) {
assert(typeof name === 'string');
// Defaults.
const inherit = {
env: true,
args: true,
query: true,
hash: true,
options: true,
data: false,
...inheritFiltered
};
const child = new Config(this.module);

@@ -167,8 +189,20 @@

_filter(name, this.env, child.env);
_filter(name, this.args, child.args);
_filter(name, this.query, child.query);
_filter(name, this.hash, child.hash);
_filter(name, this.options, child.options);
if (inherit.env)
_filter(name, this.env, child.env);
if (inherit.args)
_filter(name, this.args, child.args);
if (inherit.query)
_filter(name, this.query, child.query);
if (inherit.hash)
_filter(name, this.hash, child.hash);
if (inherit.options)
_filter(name, this.options, child.options);
if (inherit.data)
_filter(name, this.data, child.data);
return child;

@@ -175,0 +209,0 @@ }

{
"name": "bcfg",
"version": "0.1.7",
"version": "0.1.8",
"description": "Config parser for bcoin",

@@ -18,3 +18,3 @@ "keywords": [

"scripts": {
"lint": "eslint lib/ || exit 0",
"lint": "eslint lib/",
"test": "bmocha --reporter spec test/*-test.js"

@@ -21,0 +21,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