| 104 | * @returns {boolean | ((value: string) => string)} true/false, when unconditionally true/false, or a template function to determine the value at runtime |
| 105 | */ |
| 106 | const compileBooleanMatcher = (map) => { |
| 107 | const positiveItems = Object.keys(map).filter((i) => map[i]); |
| 108 | const negativeItems = Object.keys(map).filter((i) => !map[i]); |
| 109 | if (positiveItems.length === 0) return false; |
| 110 | if (negativeItems.length === 0) return true; |
| 111 | return compileBooleanMatcherFromLists(positiveItems, negativeItems); |
| 112 | }; |
| 113 | |
| 114 | /** |
| 115 | * Compile boolean matcher from lists. |