@sensorfactdev/draconarius
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -60,3 +60,3 @@ <a name="Draconarius"></a> | ||
| --- | --- | | ||
| flags | <code>object</code> | | ||
| flags | <code>object</code> \| <code>array</code> | | ||
@@ -63,0 +63,0 @@ <a name="Draconarius.version"></a> |
const Pack = require('../package.json'); | ||
const isArrayOfStrings = require('./isArrayOfStrings'); | ||
const isObject = require('./isObject'); | ||
@@ -11,11 +12,13 @@ const isValidFlagValue = require('./isValidFlagValue'); | ||
* Creates an instance of Draconarius. | ||
* @param {object} flags | ||
* @param {object|array} flags | ||
* @memberof Draconarius | ||
*/ | ||
constructor(flags) { | ||
if (!isObject(flags)) { | ||
throw new TypeError(`Draconarius constructor expects flags to be an object but received \`${JSON.stringify(flags)}\``); | ||
constructor(flags = []) { | ||
if (isArrayOfStrings(flags)) { | ||
this.flags = flags.reduce((acc, flag) => ({ ...acc, [flag]: true }), {}); | ||
} else if (isObject(flags)) { | ||
this.flags = flags; | ||
} else { | ||
throw new TypeError(`Draconarius constructor expects flags to be an object or an array of strings, but received \`${JSON.stringify(flags)}\``); | ||
} | ||
this.flags = flags; | ||
} | ||
@@ -22,0 +25,0 @@ |
{ | ||
"name": "@sensorfactdev/draconarius", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Manage (feature)flags like a Roman soldier\"", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
150705
10
123
1