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

Function when

packages/effect/src/internal/matcher.ts:249–267  ·  view source on GitHub ↗
(
  pattern: P,
  f: Fn
)

Source from the content-addressed store, hash-verified

247
248/** @internal */
249export const when = <
250 R,
251 const P extends Types.PatternPrimitive<R> | Types.PatternBase<R>,
252 Ret,
253 Fn extends (_: Types.WhenMatch<R, P>) => Ret
254>(
255 pattern: P,
256 f: Fn
257) =>
258<I, F, A, Pr>(
259 self: Matcher<I, F, R, A, Pr, Ret>
260): Matcher<
261 I,
262 Types.AddWithout<F, Types.PForExclude<P>>,
263 Types.ApplyFilters<I, Types.AddWithout<F, Types.PForExclude<P>>>,
264 A | ReturnType<Fn>,
265 Pr,
266 Ret
267> => (self as any).add(makeWhen(makePredicate(pattern), f as any))
268
269/** @internal */
270export const whenOr = <

Callers

nothing calls this directly

Calls 3

makeWhenFunction · 0.85
makePredicateFunction · 0.85
addMethod · 0.65

Tested by

no test coverage detected