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

Function compact

packages/effect/src/TxHashMap.ts:2062–2069  ·  view source on GitHub ↗
(
  self: TxHashMap<K, Option.Option<A>>
)

Source from the content-addressed store, hash-verified

2060 * @since 4.0.0
2061 */
2062export const compact = <K, A>(
2063 self: TxHashMap<K, Option.Option<A>>
2064): Effect.Effect<TxHashMap<K, A>> =>
2065 Effect.gen(function*() {
2066 const currentMap = yield* TxRef.get(self.ref)
2067 const compactedMap = HashMap.compact(currentMap)
2068 return yield* fromHashMap(compactedMap)
2069 }).pipe(Effect.tx)
2070
2071/**
2072 * Returns an array of all key-value pairs in the TxHashMap.

Callers

nothing calls this directly

Calls 4

fromHashMapFunction · 0.85
compactMethod · 0.80
pipeMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected