MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / complementary

Function complementary

src/ui-server/api/screens.ts:659–671  ·  view source on GitHub ↗

`x` and `!x`, or `a && x` and `a && !x`.

(a: string, b: string)

Source from the content-addressed store, hash-verified

657
658/** `x` and `!x`, or `a && x` and `a && !x`. */
659function complementary(a: string, b: string): boolean {
660 if (!a || !b) return false;
661 const pa = a.split(' && ');
662 const pb = b.split(' && ');
663 if (pa.length !== pb.length) return false;
664 let flips = 0;
665 for (let i = 0; i < pa.length; i++) {
666 if (pa[i] === pb[i]) continue;
667 if (pa[i] === `!${pb[i]}` || pb[i] === `!${pa[i]}`) flips++;
668 else return false;
669 }
670 return flips === 1;
671}
672
673function toPosix(p: string): string {
674 return p.replace(/\\/g, '/');

Callers 1

buildScreensFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected