lucid-extension-sdk 0.0.248 → 0.0.249
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.
|
@@ -90,6 +90,7 @@ export declare function strictObjectValidator<T extends {
|
|
|
90
90
|
[key: string]: (p1: unknown) => p1 is unknown;
|
|
91
91
|
}>(validatorStructure: T): (subject: unknown) => subject is DestructureGuardedTypeObj<T>;
|
|
92
92
|
export declare function recordValidator<K extends string, V>(keyList: K[], valueValidator: Validator<V>): (x: unknown) => x is Record<K, V>;
|
|
93
|
+
export declare function typedRecordValidator<K extends string | number | symbol, V>(keyValidator: Validator<K>, valueValidator: Validator<V>): (x: unknown) => x is Record<K, V>;
|
|
93
94
|
export declare function objectOfValidator<T>(subValidator: Validator<T>): (x: unknown) => x is Record<any, T>;
|
|
94
95
|
/**
|
|
95
96
|
* Create a validator which allows the target to be either null or satisfy the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.asAssertion = exports.validatorWithMessage = exports.minLengthValidator = exports.maxLengthValidator = exports.isDate = exports.isPositiveNumber = exports.isSize = exports.isPanelSize = exports.isBoundingBox = exports.isPointLike = exports.isOpacity = exports.isTrue = exports.isFlag = exports.isRestrictions = exports.isStringOrNegativeOne = exports.isBooleanOrEmptyString = exports.isNumberOrEmptyString = exports.isSet = exports.propertyValidator = exports.exclude = exports.both = exports.either = exports.isNullOption = exports.nullableOption = exports.option = exports.nullable = exports.objectOfValidator = exports.recordValidator = exports.strictObjectValidator = exports.partialObjectValidator = exports.objectValidator = exports.mapValidator = exports.someValidator = exports.someValue = exports.tupleValidator = exports.arrayValidator = exports.rangeValidator = exports.enumValidator = exports.stringEnumValidator = void 0;
|
|
3
|
+
exports.asAssertion = exports.validatorWithMessage = exports.minLengthValidator = exports.maxLengthValidator = exports.isDate = exports.isPositiveNumber = exports.isSize = exports.isPanelSize = exports.isBoundingBox = exports.isPointLike = exports.isOpacity = exports.isTrue = exports.isFlag = exports.isRestrictions = exports.isStringOrNegativeOne = exports.isBooleanOrEmptyString = exports.isNumberOrEmptyString = exports.isSet = exports.propertyValidator = exports.exclude = exports.both = exports.either = exports.isNullOption = exports.nullableOption = exports.option = exports.nullable = exports.objectOfValidator = exports.typedRecordValidator = exports.recordValidator = exports.strictObjectValidator = exports.partialObjectValidator = exports.objectValidator = exports.mapValidator = exports.someValidator = exports.someValue = exports.tupleValidator = exports.arrayValidator = exports.rangeValidator = exports.enumValidator = exports.stringEnumValidator = void 0;
|
|
4
4
|
const checks_1 = require("../checks");
|
|
5
5
|
const object_1 = require("../object");
|
|
6
6
|
/*********************************************************************************
|
|
@@ -192,6 +192,15 @@ function recordValidator(keyList, valueValidator) {
|
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
194
|
exports.recordValidator = recordValidator;
|
|
195
|
+
function typedRecordValidator(keyValidator, valueValidator) {
|
|
196
|
+
return (x) => {
|
|
197
|
+
if ((0, checks_1.isArray)(x) || !(0, checks_1.isObject)(x)) {
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
return Object.keys(x).every((key) => keyValidator(key)) && Object.values(x).every((val) => valueValidator(val));
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
exports.typedRecordValidator = typedRecordValidator;
|
|
195
204
|
function objectOfValidator(subValidator) {
|
|
196
205
|
return (x) => {
|
|
197
206
|
if ((0, checks_1.isArray)(x) || !(0, checks_1.isObject)(x)) {
|