MCPcopy Create free account
hub / github.com/TechJeeper/Printventory / collapseAdjacentDuplicateBinaryOps

Function collapseAdjacentDuplicateBinaryOps

query-builder.js:213–222  ·  view source on GitHub ↗

AND AND / OR OR is equivalent to one operator; collapse before compile / IPC.

(arr)

Source from the content-addressed store, hash-verified

211
212 /** AND AND / OR OR is equivalent to one operator; collapse before compile / IPC. */
213 function collapseAdjacentDuplicateBinaryOps(arr) {
214 for (let i = 1; i < arr.length; i++) {
215 const a = arr[i - 1];
216 const b = arr[i];
217 if (a.t === "op" && b.t === "op" && a.op === b.op) {
218 arr.splice(i, 1);
219 i--;
220 }
221 }
222 }
223
224 function normalizeTokensForIpc(tokens) {
225 const out = tokens.filter((tok) => {

Calls

no outgoing calls

Tested by

no test coverage detected