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

Function kindWords

ui/src/lib/steps-model.ts:196–216  ·  view source on GitHub ↗
(kind: WireStep['kind'], project: ProjectKind = 'app', step?: WireStep)

Source from the content-addressed store, hash-verified

194
195/** The singular and the plural, for counts: `1 endpoint`, `3 outside the index`. */
196export function kindWords(kind: WireStep['kind'], project: ProjectKind = 'app', step?: WireStep): [string, string] {
197 switch (kind) {
198 case 'screen':
199 if (step?.screen?.endpoint) return ['endpoint', 'endpoints'];
200 return project === 'api' ? ['endpoint', 'endpoints'] : project === 'web' ? ['page', 'pages'] : ['screen', 'screens'];
201 case 'trigger':
202 return ['handler', 'handlers'];
203 case 'bridge':
204 // An endpoint reached across a tier is a call to the server wherever it is.
205 if (step?.screen?.endpoint) return ['call to the server', 'calls to the server'];
206 return project === 'app' ? ['native call', 'native calls'] : project === 'web' ? ['call to the server', 'calls to the server'] : ['call to another tier', 'calls to another tier'];
207 case 'event':
208 return project === 'app' ? ['native event', 'native events'] : project === 'web' ? ['arrives from the server', 'arrive from the server'] : ['arrives from a queue or bus', 'arrive from a queue or bus'];
209 case 'store':
210 return project === 'api' ? ['data call', 'data calls'] : ['store action', 'store actions'];
211 case 'effect':
212 return ['outside the index', 'outside the index'];
213 default:
214 return ['start', 'start'];
215 }
216}
217
218/** `3 handlers`, `1 endpoint`, `11 outside the index`. */
219export function countWords(n: number, kind: WireStep['kind'], project: ProjectKind = 'app'): string {

Callers 3

kindWordFunction · 0.85
countWordsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected