New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ezzy-environment

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ezzy-environment - npm Package Compare versions

Comparing version 0.1.22 to 0.1.23

7

package.json
{
"name": "ezzy-environment",
"description": "A lightweight tool to provide common environment settings",
"version": "0.1.22",
"version": "0.1.23",
"author": {

@@ -18,2 +18,3 @@ "name": "Moises Romero",

"test": "node node_modules/ezzy-testing",
"test-debug": "node $NODE_DEBUG_OPTION node_modules/ezzy-testing",
"prebuild": "npm install",

@@ -25,4 +26,4 @@ "build": "npm run coverage"

"deepmerge": "^1.5.2",
"ezzy-argument": "^0.1.17",
"ezzy-logger": "^0.1.21"
"ezzy-argument": "^0.1.18",
"ezzy-logger": "^0.1.22"
},

@@ -29,0 +30,0 @@ "devDependencies": {

@@ -10,2 +10,3 @@ let pkg;

const deepmerge = require('deepmerge');
const logger = require('ezzy-logger').logger;
let inst;

@@ -79,2 +80,8 @@

/**
* Shortcut to testing property.
* @type {boolean}
*/
this.testing = this.test;
/**
* If environment is in alpha.

@@ -199,6 +206,21 @@ * @type {boolean}

const argConfig = argument(['configuration', 'package'], undefined);
if (argConfig) {
try {
configuration = deepmerge(argConfig, JSON.stringify(argConfig));
} catch (e) {
logger.error({
title: 'Configuration',
message: `The configuration provided isn't a valid json string.`,
error: e
});
}
}
let config = configuration[namespace] || configuration[`_${namespace}`];
if (typeof config === 'object' && typeof config[this.name] === 'object') {
config = deepmerge(config, config[this.name]);
const subEnvConfig = config[this.name] || config[`_${this.name}`] ||
config[this.name.toUpperCase()];
if (subEnvConfig) {
config = deepmerge(config, subEnvConfig);
}

@@ -205,0 +227,0 @@

@@ -17,2 +17,3 @@ const Environment = require('./Environment');

expect(environment.test).toBe(true);
expect(environment.testing).toBe(true);
done();

@@ -70,2 +71,29 @@ });

it('should access private configuration options', () => {
const conf = environment.getConfiguration('sample', {
_sample: 'abc',
TEST: {
_sample: 'def'
}
});
expect(conf).toBe('def');
});
it('should access correct configuration option', () => {
let conf = environment.getConfiguration('sample', {
_sample: 'abc',
TEST: {
_sample: ''
}
});
expect(conf).toBe('');
conf = environment.getConfiguration('sample', {
_sample: '',
TEST: {
_sample: 'abc'
}
});
expect(conf).toBe('abc');
});
it('should be able to access properties in dot notation', () => {

@@ -102,2 +130,4 @@ const conf = {

.toBe(1);
expect(environment.getConfiguration('testProp.prop1.prop2.a', conf))
.toBe(1);
expect(environment.getConfiguration('testProp.prop1.prop3.a', conf))

@@ -104,0 +134,0 @@ .toBe(1);

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