MCPcopy Create free account
hub / github.com/codemix/graph / buildBinaryCondition

Function buildBinaryCondition

packages/graph/src/grammar.js:18227–18244  ·  view source on GitHub ↗
(head, tail, operator)

Source from the content-addressed store, hash-verified

18225
18226
18227 function buildBinaryCondition(head, tail, operator) {
18228 if (tail.length === 0) {
18229 return head;
18230 }
18231 const typeMap = {
18232 'AND': 'AndCondition',
18233 'OR': 'OrCondition',
18234 'XOR': 'XorCondition'
18235 };
18236 return tail.reduce((left, element) => {
18237 const [_, __, ___, right] = element;
18238 return {
18239 type: typeMap[operator],
18240 left: left,
18241 right: right
18242 };
18243 }, head);
18244 }
18245
18246 // Helper to check if a LabelOr chain is just simple labels (no AND, NOT, wildcard)
18247 function isSimpleOrChain(expr) {

Callers 3

peg$f138Function · 0.85
peg$f139Function · 0.85
peg$f140Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected