lucid-extension-sdk 0.0.199 → 0.0.200
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.
|
@@ -12,16 +12,17 @@ const object_1 = require("../object");
|
|
|
12
12
|
* and is one of the values in the specified enum (object).
|
|
13
13
|
*/
|
|
14
14
|
function stringEnumValidator(enumMap) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const enumValues = new Set();
|
|
16
|
+
for (const key in enumMap) {
|
|
17
|
+
const enumValue = enumMap[key];
|
|
18
|
+
if ((0, checks_1.isString)(enumValue)) {
|
|
19
|
+
enumValues.add(enumValue);
|
|
18
20
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return false;
|
|
21
|
+
}
|
|
22
|
+
// this allows using Set:has on unknown type
|
|
23
|
+
const unknownEnumValues = enumValues;
|
|
24
|
+
return (x) => {
|
|
25
|
+
return unknownEnumValues.has(x);
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
28
|
exports.stringEnumValidator = stringEnumValidator;
|