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

Function compact

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

Source from the content-addressed store, hash-verified

2017 * @since 4.0.0
2018 */
2019export const compact = <K, A>(
2020 self: TxHashMap<K, Option.Option<A>>
2021): Effect.Effect<TxHashMap<K, A>> =>
2022 Effect.gen(function*() {
2023 const currentMap = yield* TxRef.get(self.ref)
2024 const compactedMap = HashMap.compact(currentMap)
2025 return yield* fromHashMap(compactedMap)
2026 }).pipe(Effect.tx)
2027
2028/**
2029 * Returns an array of all key-value pairs in the TxHashMap.

Callers

nothing calls this directly

Calls 3

fromHashMapFunction · 0.85
pipeMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected