(expr: string)
| 230 | } |
| 231 | |
| 232 | function parseSingleCondition(expr: string): RuleCondition { |
| 233 | const match = expr.match(/^(\S+)\s*(<=|>=|!=|<|>|==|=|includes|not-includes|matches|not-matches)\s*(.+)$/); |
| 234 | if (!match) return { type: 'field-check', field: expr }; |
| 235 | |
| 236 | const [, field, rawOp, rawVal] = match; |
| 237 | return { |
| 238 | type: 'field-check', |
| 239 | field, |
| 240 | op: parseOp(rawOp), |
| 241 | value: parseValue(rawVal), |
| 242 | }; |
| 243 | } |
| 244 | |
| 245 | function parseOp(op: string): RuleCondition['op'] { |
| 246 | switch (op) { |
no test coverage detected