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

Function fromStepWithMetadata

packages/effect/src/Schedule.ts:306–316  ·  view source on GitHub ↗
(
  step: Effect<
    (options: InputMetadata<Input>) => Pull.Pull<[Output, Duration.Duration], ErrorX, Output, EnvX>,
    Error,
    Env
  >
)

Source from the content-addressed store, hash-verified

304 * @since 4.0.0
305 */
306export const fromStepWithMetadata = <Input, Output, EnvX, ErrorX, Error, Env>(
307 step: Effect<
308 (options: InputMetadata<Input>) => Pull.Pull<[Output, Duration.Duration], ErrorX, Output, EnvX>,
309 Error,
310 Env
311 >
312): Schedule<Output, Input, Error | Pull.ExcludeDone<ErrorX>, Env | EnvX> =>
313 fromStep(effect.map(step, (f) => {
314 const meta = metadataFn()
315 return (now, input) => f(meta(now, input))
316 }))
317
318/**
319 * Extracts the step function from a Schedule.

Callers 6

durationFunction · 0.85
duringFunction · 0.85
exponentialFunction · 0.85
fixedFunction · 0.85
spacedFunction · 0.85
windowedFunction · 0.85

Calls 4

fromStepFunction · 0.85
metadataFnFunction · 0.85
fFunction · 0.50
mapMethod · 0.45

Tested by

no test coverage detected