MCPcopy Index your code
hub / github.com/github/copilot-sdk / groupGoJSONMatchTerms

Function groupGoJSONMatchTerms

scripts/codegen/go.ts:1491–1517  ·  view source on GitHub ↗
(spec: GoVariantMatchSpec)

Source from the content-addressed store, hash-verified

1489}
1490
1491function groupGoJSONMatchTerms(spec: GoVariantMatchSpec): GoJSONMatchTermGroup[] {
1492 const groups = new Map<string, GoJSONMatchTermGroup>();
1493 const getGroup = (parentPath: string[]): GoJSONMatchTermGroup => {
1494 const key = goJSONMatchPathKey(parentPath);
1495 const existing = groups.get(key);
1496 if (existing) return existing;
1497 const group = { parentPath, positiveTerms: [], negativeProperties: [] };
1498 groups.set(key, group);
1499 return group;
1500 };
1501
1502 for (const term of spec.positiveTerms) {
1503 getGroup(goJSONMatchTermParentPath(term)).positiveTerms.push(term);
1504 }
1505 for (const path of spec.negativeExistsPaths) {
1506 const group = getGroup(goJSONMatchPathParentPath(path));
1507 group.negativeProperties.push(goJSONMatchPathProperty(path));
1508 }
1509
1510 return [...groups.values()]
1511 .map((group) => ({
1512 parentPath: group.parentPath,
1513 positiveTerms: group.positiveTerms.sort(compareGoJSONMatchTerms),
1514 negativeProperties: [...new Set(group.negativeProperties)].sort(),
1515 }))
1516 .sort((left, right) => compareGoJSONPaths(left.parentPath, right.parentPath));
1517}
1518
1519function goJSONRawStructFields(propNames: string[]): Map<string, string> {
1520 const fieldNames = new Map<string, string>();

Callers 1

Calls 6

getGroupFunction · 0.85
goJSONMatchPathPropertyFunction · 0.85
compareGoJSONPathsFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…