| 96 | } |
| 97 | |
| 98 | class GroupRule<T> implements Rule { |
| 99 | predefined: Array<T>; |
| 100 | check: CheckFuction; |
| 101 | minimalVersion?: string; |
| 102 | constructor( |
| 103 | predefined: Array<T>, |
| 104 | options: readonly T[], |
| 105 | minimalVersion?: string |
| 106 | ) { |
| 107 | this.predefined = predefined; |
| 108 | this.minimalVersion = minimalVersion; |
| 109 | this.check = (value: Array<T>) => { |
| 110 | if (!value.map((item) => options.includes(item)).includes(false)) { |
| 111 | return true; |
| 112 | } else { |
| 113 | for (const item of value) { |
| 114 | if (!options.includes(item)) { |
| 115 | console.log("check fail, invalid item", item); |
| 116 | } |
| 117 | } |
| 118 | return false; |
| 119 | } |
| 120 | }; |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | class FlexibleGroupRule<T> implements Rule { |
| 125 | predefined: Array<T>; |
nothing calls this directly
no outgoing calls
no test coverage detected