configchecker
Advanced tools
Comparing version 1.0.6 to 1.2.0
@@ -0,0 +0,0 @@ import { IConfigSource } from '../interfaces/IConfigSource'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -7,5 +7,5 @@ import { IConfigValueProfile } from '../interfaces/IConfigValueProfile'; | ||
constructor(value: TValue, profile: IConfigValueProfile, canBeUndefined?: boolean); | ||
readonly about: string; | ||
private readonly about; | ||
required(): ConfigValue<NonNullable<TValue>>; | ||
default(value: NonNullable<TValue>): ConfigValue<TValue>; | ||
default(value: NonNullable<TValue>): ConfigValue<NonNullable<TValue>>; | ||
custom<TvalueCustom>(conversionType: string, convert: (value: NonNullable<TValue>) => TvalueCustom): ConfigValue<TvalueCustom | undefined>; | ||
@@ -15,4 +15,4 @@ readonly object: { | ||
}; | ||
asType<TvalueCustom>(): ConfigValue<TvalueCustom>; | ||
asType<TvalueCustom>(typeChecker?: (value: TValue) => boolean): ConfigValue<TvalueCustom>; | ||
private checkThatValueCanBeUndefinedToPreventMultipleUsageOfRequiredOrDefault; | ||
} |
@@ -13,3 +13,7 @@ "use strict"; | ||
get: function () { | ||
return ("\n**Key:** \"" + this.profile.key + "\"\n**Description:** \"" + this.profile.description + "\"\n").trim(); | ||
var about = this.profile.key; | ||
if (this.profile.description) { | ||
this.profile.description += "(" + this.profile.description.trim() + "\")"; | ||
} | ||
return about; | ||
}, | ||
@@ -32,3 +36,3 @@ enumerable: true, | ||
ConfigValue.prototype.custom = function (conversionType, convert) { | ||
if (typeof this.value === 'undefined') { | ||
if (typeof this.value === 'undefined' || this.value === '') { | ||
return new ConfigValue(undefined, this.profile); | ||
@@ -55,3 +59,8 @@ } | ||
// TODO: Strange ts-lint warning Shadowed name: 'T' | ||
ConfigValue.prototype.asType = function () { | ||
ConfigValue.prototype.asType = function (typeChecker) { | ||
if (typeChecker) { | ||
if (!typeChecker(this.value)) { | ||
throw new Error("Value is not in expected format - rejected by type checker function. " + this.about); | ||
} | ||
} | ||
return new ConfigValue(this.value, this.profile); | ||
@@ -58,0 +67,0 @@ }; |
@@ -0,0 +0,0 @@ import { ConfigValue } from './ConfigValue'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { ConfigChecker } from './classes/ConfigChecker'; |
@@ -0,0 +0,0 @@ "use strict"; |
export interface IConfigSource { | ||
[key: string]: string | undefined; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -0,0 +0,0 @@ import { ConfigChecker } from '../classes/ConfigChecker'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -0,0 +0,0 @@ export declare function objectDecapitalize<T>(mixedObject: { |
@@ -0,0 +0,0 @@ "use strict"; |
{ | ||
"name": "configchecker", | ||
"version": "1.0.6", | ||
"version": "1.2.0", | ||
"description": "Awesome checker of config - fully support typescript, fluent API,...", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -0,0 +0,0 @@ # Config Checker |
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
17440
292