node-powertools
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -298,2 +298,6 @@ (function (root, factory) { | ||
var isValidType = types.some(function (type) { | ||
if (type === 'any') { | ||
return true; | ||
} | ||
return typeof value === type || (type === 'array' && Array.isArray(value)); | ||
@@ -383,2 +387,3 @@ }); | ||
// If the plan default is not an object, make it one | ||
if (!planDefault || typeof planDefault === 'undefined' || typeof planDefault.default === 'undefined') { | ||
@@ -390,2 +395,9 @@ planDefault = { | ||
// Set the defaults of the plan default | ||
planDefault.default = typeof planDefault.default === 'undefined' ? undefined : planDefault.default; | ||
planDefault.value = typeof planDefault.value === 'undefined' ? undefined : planDefault.value; | ||
planDefault.types = planDefault.types || ['any']; | ||
planDefault.min = planDefault.min || 0; | ||
planDefault.max = planDefault.max || Infinity; | ||
// If the user has not set a value for this setting, use the plan default | ||
@@ -392,0 +404,0 @@ if (typeof userSetting === 'undefined') { |
{ | ||
"name": "node-powertools", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Powerful assistive functions for Node and Browser environments.", | ||
@@ -33,2 +33,2 @@ "main": "dist/index.js", | ||
} | ||
} | ||
} |
@@ -298,2 +298,6 @@ (function (root, factory) { | ||
var isValidType = types.some(function (type) { | ||
if (type === 'any') { | ||
return true; | ||
} | ||
return typeof value === type || (type === 'array' && Array.isArray(value)); | ||
@@ -383,2 +387,3 @@ }); | ||
// If the plan default is not an object, make it one | ||
if (!planDefault || typeof planDefault === 'undefined' || typeof planDefault.default === 'undefined') { | ||
@@ -390,2 +395,9 @@ planDefault = { | ||
// Set the defaults of the plan default | ||
planDefault.default = typeof planDefault.default === 'undefined' ? undefined : planDefault.default; | ||
planDefault.value = typeof planDefault.value === 'undefined' ? undefined : planDefault.value; | ||
planDefault.types = planDefault.types || ['any']; | ||
planDefault.min = planDefault.min || 0; | ||
planDefault.max = planDefault.max || Infinity; | ||
// If the user has not set a value for this setting, use the plan default | ||
@@ -392,0 +404,0 @@ if (typeof userSetting === 'undefined') { |
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
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
52301
1167