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

ezzy-config-setup

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

ezzy-config-setup - npm Package Compare versions

Comparing version 0.1.16 to 0.1.17

3

package.json
{
"name": "ezzy-config-setup",
"description": "A complex function configuration",
"version": "0.1.16",
"version": "0.1.17",
"author": {

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

"coverage": "node node_modules/ezzy-testing/coverage",
"pretest": "npm install",
"test": "node node_modules/ezzy-testing",

@@ -19,0 +18,0 @@ "prebuild": "npm install",

@@ -41,3 +41,3 @@ /*!

* ["method:string"],
* ["config:object", "callback"]
* ["config:object", "callback:function|undefined"]
* );

@@ -124,3 +124,4 @@ *

let name;
let type;
let types;
let optional;
let value;

@@ -167,8 +168,12 @@ let origConfig;

value = allArgs[i][s].split(':');
name = value[0];
type = value[1] || '*';
name = value[0].trim();
types = (value[1] || '').replace(/\s/g, '').split(/[,|]/);
optional = /\?/.test(value[1]) ||
types.includes('*') || types.includes('undefined');
if (name === 'this' && trueTypeOf(args[s]) === 'object') {
extend(config, args[s]);
} else if (type === '*' || trueTypeOf(args[s]) === type) {
} else if (optional) {
config[name] = args[s] === undefined ? config[name] : args[s];
} else if (types.includes(trueTypeOf(args[s]))) {
config[name] = args[s];

@@ -175,0 +180,0 @@ } else {

@@ -82,2 +82,16 @@ const configSetup = require('./configSetup');

it('should define an optional configuration properly', () => {
const getConfig = (...args) => configSetup({
arrayProp: [],
optionalBoolean: false
}, args,
['arrayProp : array?', 'optionalBoolean : boolean | undefined']);
let config = getConfig(undefined, true);
expect(config.arrayProp).toEqual([]);
expect(config.optionalBoolean).toBe(true);
config = getConfig([1,2,3], undefined);
expect(config.arrayProp).toEqual([1,2,3]);
expect(config.optionalBoolean).toBe(false);
});
});
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