| 158 | } |
| 159 | |
| 160 | override compute(arg: FieldContext<any>): readonly TElement[] { |
| 161 | return this.fns.reduce((prev, f) => { |
| 162 | const value = f(arg); |
| 163 | |
| 164 | if (value === undefined || value === IGNORED) { |
| 165 | return prev; |
| 166 | } else if (isArray(value)) { |
| 167 | return [...prev, ...(this.ignore ? value.filter((e) => !this.ignore!(e)) : value)]; |
| 168 | } else { |
| 169 | if (this.ignore && this.ignore(value as TElement | TIgnore | undefined)) { |
| 170 | return prev; |
| 171 | } |
| 172 | return [...prev, value]; |
| 173 | } |
| 174 | }, [] as TElement[]); |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | /** Logic that combines its individual logic function results by aggregating them in an array. */ |