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

Function forEachWhile

packages/effect/src/Sink.ts:1851–1860  ·  view source on GitHub ↗
(
  f: (input: In) => Effect.Effect<boolean, E, R>
)

Source from the content-addressed store, hash-verified

1849 * @since 2.0.0
1850 */
1851export const forEachWhile = <In, E, R>(
1852 f: (input: In) => Effect.Effect<boolean, E, R>
1853): Sink<void, In, never, E, R> =>
1854 forEachWhileArray(Effect.fnUntraced(function*(input) {
1855 for (let i = 0; i < input.length; i++) {
1856 const cont = yield* f(input[i])
1857 if (!cont) return false
1858 }
1859 return true
1860 }))
1861
1862/**
1863 * Runs an effectful function for each non-empty input array while it returns

Callers

nothing calls this directly

Calls 2

forEachWhileArrayFunction · 0.85
fFunction · 0.50

Tested by

no test coverage detected