isRuleGroup()
function isRuleGroup(value): value is RuntimeRuleGroup;
Defined in: packages/rxdb/src/query/query-matching.utils.ts:51
判断是否是 RuleGroup
Parameters
| Parameter | Type | Description |
|---|---|---|
value | unknown | 要检查的值 |
Returns
value is RuntimeRuleGroup
如果是 RuleGroup 则返回 true,否则返回 false
Remarks
浅层判断:只校验本层的 combinator 与 rules,不递归进 rules 的元素。
这一层必须校验完整——谓词断言的 RuntimeRuleGroup 要求 combinator 只取
'and' | 'or'、rules 是数组,谓词比断言宽的话,下游就会拿着一个类型系统
说「已经验过」的值去访问不存在的成员(whereUsesRelations 的
for (const rule of rg.rules) 会直接抛 TypeError)。
需要连 rules 的每个元素一起校验的场景(where 来自调用方传进来的任意值,
没有别处替它把关),用 QueryTask 里的深校验版,它以本函数为第一步。