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
- return (x) => {
16
- if (!(0, checks_1.isString)(x)) {
17
- return false;
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
- for (const key in enumMap) {
20
- if (enumMap[key] === x) {
21
- return true;
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.199",
3
+ "version": "0.0.200",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",