MCPcopy Create free account
hub / github.com/effect-app/libs / compact

Function compact

repos/effect/packages/effect/src/Chunk.ts:1130–1138  ·  view source on GitHub ↗
(self: Chunk<Option<A>>)

Source from the content-addressed store, hash-verified

1128 * **Example** (Flat mapping chunks)
1129 *
1130 * ```ts import.meta.vitest
1131 * import { Chunk } from "effect"
1132 *
1133 * const chunk = Chunk.make(1, 2, 3)
1134 * const duplicated = Chunk.flatMap(chunk, (n) => Chunk.make(n, n))
1135 * Chunk.toArray(duplicated) // => [1, 1, 2, 2, 3, 3]
1136 *
1137 * // Flattening nested arrays
1138 * const words = Chunk.make("hello", "world")
1139 * const letters = Chunk.flatMap(
1140 * words,
1141 * (word) => Chunk.fromIterable(word.split(""))

Callers

nothing calls this directly

Calls 2

fromArrayUnsafeFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…