configchecker
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -9,3 +9,3 @@ import { IConfigValueProfile } from '../interfaces/IConfigValueProfile'; | ||
required(): ConfigValue<NonNullable<TValue>>; | ||
default(value: NonNullable<TValue>): ConfigValue<NonNullable<TValue>>; | ||
default(defaultValue: NonNullable<TValue>): ConfigValue<NonNullable<TValue>>; | ||
custom<TvalueCustom>(conversionType: string, convert: (value: NonNullable<TValue>) => TvalueCustom): ConfigValue<TvalueCustom | undefined>; | ||
@@ -12,0 +12,0 @@ readonly object: { |
@@ -24,3 +24,3 @@ "use strict"; | ||
this.checkThatValueCanBeUndefinedToPreventMultipleUsageOfRequiredOrDefault(); | ||
if (typeof this.value === 'undefined') { | ||
if (this.value === undefined) { | ||
throw Error("In config should be defined " + this.profile.key + ". \n " + this.about); | ||
@@ -30,6 +30,13 @@ } | ||
}; | ||
ConfigValue.prototype.default = function (value) { | ||
ConfigValue.prototype.default = function (defaultValue) { | ||
this.checkThatValueCanBeUndefinedToPreventMultipleUsageOfRequiredOrDefault(); | ||
// TODO: ... it is saying on next line: "Type 'ConfigValue<T>' is not assignable to type 'ConfigValue<NonNullable<T>>'. Type 'T' is not assignable to type 'NonNullable<T>': | ||
return new ConfigValue(this.value || value, this.profile, false); | ||
var value; | ||
if (this.value !== undefined) { | ||
value = this.value; | ||
} | ||
else { | ||
value = defaultValue; | ||
} | ||
return new ConfigValue(value, this.profile, false); | ||
}; | ||
@@ -36,0 +43,0 @@ ConfigValue.prototype.custom = function (conversionType, convert) { |
{ | ||
"name": "configchecker", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Awesome checker of config - fully support typescript, fluent API,...", | ||
@@ -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
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
17598
299