@nu-art/ts-common 0.202.52 → 0.202.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@ export declare const tsValidateNonMandatoryObject: <T>(validator: ValidatorTypeR
|
|
|
25
25
|
export declare const tsValidateOptionalObject: <T>(validator: ValidatorTypeResolver<T>) => ((input?: T | undefined) => any)[];
|
|
26
26
|
export declare const tsValidator_valueByKey: <T extends unknown>(validatorObject: {
|
|
27
27
|
[k: string]: Validator<any> | import("./validator-core").TypeValidator<any>;
|
|
28
|
-
}) => ValidatorTypeResolver<T>;
|
|
28
|
+
}, prop?: string) => ValidatorTypeResolver<T>;
|
|
29
29
|
export declare const tsValidator_ArrayOfObjectsByKey: <T extends Object>(key: keyof T, validatorMap: {
|
|
30
30
|
[k: string]: ValidatorTypeResolver<T>;
|
|
31
31
|
}) => Validator<T[]>;
|
|
@@ -194,9 +194,9 @@ const tsValidateNonMandatoryObject = (validator) => {
|
|
|
194
194
|
};
|
|
195
195
|
exports.tsValidateNonMandatoryObject = tsValidateNonMandatoryObject;
|
|
196
196
|
exports.tsValidateOptionalObject = exports.tsValidateNonMandatoryObject;
|
|
197
|
-
const tsValidator_valueByKey = (validatorObject) => {
|
|
197
|
+
const tsValidator_valueByKey = (validatorObject, prop = 'type') => {
|
|
198
198
|
return (0, exports.tsValidateCustom)((value, parentObject) => {
|
|
199
|
-
return (0, validator_core_1.tsValidateResult)(value, validatorObject[parentObject
|
|
199
|
+
return (0, validator_core_1.tsValidateResult)(value, validatorObject[parentObject[prop]]);
|
|
200
200
|
});
|
|
201
201
|
};
|
|
202
202
|
exports.tsValidator_valueByKey = tsValidator_valueByKey;
|