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

convict

Package Overview
Dependencies
Maintainers
7
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 0.3.3 to 0.4.0

8

lib/convict.js

@@ -65,3 +65,4 @@ /*

validate(kids, p, previousErrors);
} else {
} else if (! (typeof p.default === 'undefined'
&& instance[name] === p.default)) {
try {

@@ -318,4 +319,5 @@ p._format(instance[name]);

try {
this.get(path);
return true;
var r = this.get(path);
// values that are set but undefined return false
return typeof r !== 'undefined';
} catch (e) {

@@ -322,0 +324,0 @@ return false;

@@ -5,3 +5,3 @@ {

"description": "Unruly configuration management for nodejs",
"version": "0.3.3",
"version": "0.4.0",
"homepage": "https://github.com/lloyd/node-convict",

@@ -8,0 +8,0 @@ "repository": {

@@ -9,2 +9,7 @@ const should = require('should');

conf = convict({
env: {
format: ['bar', 'baz', 'foo'],
default: 'bar',
env: 'NODE_ENV'
},
foo: {

@@ -43,3 +48,8 @@ bar: 7,

});
it('should get env', function() {
var val = conf.get('env');
should.equal(val, 'bar');
});
});
});

@@ -6,2 +6,10 @@ const should = require('should');

var conf;
var conf2 = convict({
foo: {
none: {
format: String,
default: undefined
}
}
});

@@ -16,2 +24,18 @@ it('should parse a config specification from a file', function() {

it('should be valid again', function() {
(function() { conf2.validate() }).should.not.throw();
});
describe('.has()', function() {
it('should not have undefined properties', function() {
var val = conf.has('foo.bar.madeup');
should.equal(val, false);
});
it('should not have properties specified with a default of undefined', function() {
var val = conf.has('foo.none');
should.equal(val, false);
});
});
describe('.get()', function() {

@@ -18,0 +42,0 @@ it('should find a nested value', function() {

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