UNPKG

unified-query

Version:

Composable search input with autocompletion and a rich query-language parser for the Unified Data System

18 lines (17 loc) 527 B
export function analyzeIn(seg) { const list = []; const errs = []; for (const tok of seg.tokens) { if (tok.kind === 'uuid') { list.push({ id: tok.value, deep: !!tok.deep }); } else { errs.push({ message: `invalid token "${tok.raw}" for @in`, token: tok.raw, from: tok.from, to: tok.to }); } } seg.errors.push(...errs); return { keyword: 'in', parsed: list, from: seg.from, to: seg.to, raw: seg.raw }; }