Comparing version 1.0.9 to 1.0.10
@@ -12,3 +12,3 @@ import { SettingType } from "./SettingManagerFactory"; | ||
export declare function isString<T>(field: SettingField<T>): field is string; | ||
export declare function parseToSettingFieldOption<T>(key: string, defaultValue?: T): SettingFieldOption<T>; | ||
export declare function parseToSettingFieldOption<T>(key: string, referenceObj?: any, defaultValue?: T): SettingFieldOption<T>; | ||
export {}; |
@@ -26,5 +26,18 @@ "use strict"; | ||
exports.isString = isString; | ||
function parseToSettingFieldOption(key, defaultValue) { | ||
function parseToSettingFieldOption(key, referenceObj, defaultValue) { | ||
let type = 'String'; | ||
if (referenceObj && referenceObj[key]) { | ||
const referenceValue = referenceObj[key]; | ||
if (Array.isArray(referenceValue)) { | ||
type = 'Array'; | ||
} | ||
else if (typeof referenceValue == 'boolean') { | ||
type = 'Boolean'; | ||
} | ||
else if (Number.isInteger(referenceValue)) { | ||
type = 'Integer'; | ||
} | ||
} | ||
return { | ||
type: 'String', | ||
type: type, | ||
key: key, | ||
@@ -31,0 +44,0 @@ defaultValue: defaultValue |
@@ -84,3 +84,3 @@ "use strict"; | ||
const configObject = settingFields.reduce((obj, f) => { | ||
const field = (0, SettingField_1.isSettingFieldOption)(f) ? f : (0, SettingField_1.parseToSettingFieldOption)(f); | ||
const field = (0, SettingField_1.isSettingFieldOption)(f) ? f : (0, SettingField_1.parseToSettingFieldOption)(f, overrideDefaultObj); | ||
this.typeMap.set(field.key, (0, SettingField_1.getSettingType)(field.type)); | ||
@@ -87,0 +87,0 @@ obj[field.key] = getBestValue(field.key, field.defaultValue); |
@@ -12,3 +12,3 @@ import { SettingType } from "./SettingManagerFactory"; | ||
export declare function isString<T>(field: SettingField<T>): field is string; | ||
export declare function parseToSettingFieldOption<T>(key: string, defaultValue?: T): SettingFieldOption<T>; | ||
export declare function parseToSettingFieldOption<T>(key: string, referenceObj?: any, defaultValue?: T): SettingFieldOption<T>; | ||
export {}; |
@@ -26,5 +26,18 @@ "use strict"; | ||
exports.isString = isString; | ||
function parseToSettingFieldOption(key, defaultValue) { | ||
function parseToSettingFieldOption(key, referenceObj, defaultValue) { | ||
let type = 'String'; | ||
if (referenceObj && referenceObj[key]) { | ||
const referenceValue = referenceObj[key]; | ||
if (Array.isArray(referenceValue)) { | ||
type = 'Array'; | ||
} | ||
else if (typeof referenceValue == 'boolean') { | ||
type = 'Boolean'; | ||
} | ||
else if (Number.isInteger(referenceValue)) { | ||
type = 'Integer'; | ||
} | ||
} | ||
return { | ||
type: 'String', | ||
type: type, | ||
key: key, | ||
@@ -31,0 +44,0 @@ defaultValue: defaultValue |
@@ -84,3 +84,3 @@ "use strict"; | ||
const configObject = settingFields.reduce((obj, f) => { | ||
const field = (0, SettingField_1.isSettingFieldOption)(f) ? f : (0, SettingField_1.parseToSettingFieldOption)(f); | ||
const field = (0, SettingField_1.isSettingFieldOption)(f) ? f : (0, SettingField_1.parseToSettingFieldOption)(f, overrideDefaultObj); | ||
this.typeMap.set(field.key, (0, SettingField_1.getSettingType)(field.type)); | ||
@@ -87,0 +87,0 @@ obj[field.key] = getBestValue(field.key, field.defaultValue); |
{ | ||
"name": "biewangle", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./lib/cjs/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
23230
524