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

Function hashGroupKey

packages/effect/src/RequestResolver.ts:305–316  ·  view source on GitHub ↗
(get: (entry: Request.Entry<A>) => K)

Source from the content-addressed store, hash-verified

303 })
304
305const hashGroupKey = <A, K>(get: (entry: Request.Entry<A>) => K) => {
306 const groupKeys = MutableHashMap.empty<K, K>()
307 return (entry: Request.Entry<A>): unknown => {
308 const key = get(entry)
309 const okey = MutableHashMap.get(groupKeys, key)
310 if (okey._tag === "Some") {
311 return okey.value
312 }
313 MutableHashMap.set(groupKeys, key, key)
314 return key
315 }
316}
317
318/**
319 * Constructs a request resolver from a pure function.

Callers 2

makeGroupedFunction · 0.85
RequestResolver.tsFile · 0.85

Calls 3

getFunction · 0.70
getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected