MCPcopy Create free account
hub / github.com/Effect-TS/effect / groupEntities

Function groupEntities

packages/tools/api-diff/src/Diff.ts:90–106  ·  view source on GitHub ↗
(entities: Iterable<ApiEntity>)

Source from the content-addressed store, hash-verified

88}
89
90const groupEntities = (entities: Iterable<ApiEntity>): ReadonlyArray<ApiGroup> => {
91 const groups = new Map<string, Array<ApiEntity>>()
92 for (const entity of entities) {
93 const key = `${entity.module}#${entity.path.join(".")}`
94 const group = groups.get(key)
95 if (group === undefined) {
96 groups.set(key, [entity])
97 } else {
98 group.push(entity)
99 }
100 }
101 return [...groups.values()].map((group) => ({
102 module: group[0]!.module,
103 path: group[0]!.path,
104 entities: group.sort((left, right) => left.bucket.localeCompare(right.bucket))
105 }))
106}
107
108const groupName = (group: ApiGroup): string => group.path.at(-1) ?? ""
109

Callers 1

diffSnapshotsFunction · 0.85

Calls 5

joinMethod · 0.80
pushMethod · 0.80
getMethod · 0.65
setMethod · 0.65
mapMethod · 0.45

Tested by

no test coverage detected