MCPcopy Index your code
hub / github.com/Effect-TS/effect / whenOr

Function whenOr

packages/effect/src/internal/matcher.ts:284–307  ·  view source on GitHub ↗
(
  ...args: [...patterns: P, f: Fn]
)

Source from the content-addressed store, hash-verified

282
283/** @internal */
284export const whenOr = <
285 R,
286 const P extends ReadonlyArray<
287 Types.PatternPrimitive<R> | Types.PatternBase<R>
288 >,
289 Ret,
290 Fn extends (_: Types.WhenMatch<R, P[number]>) => Ret
291>(
292 ...args: [...patterns: P, f: Fn]
293) =>
294<I, F, A, Pr>(
295 self: Matcher<I, F, R, A, Pr, Ret>
296): Matcher<
297 I,
298 Types.AddWithout<F, Types.PForExclude<P[number]>>,
299 Types.ApplyFilters<I, Types.AddWithout<F, Types.PForExclude<P[number]>>>,
300 A | ReturnType<Fn>,
301 Pr,
302 Ret
303> => {
304 const onMatch = args[args.length - 1] as any
305 const patterns = args.slice(0, -1) as unknown as P
306 return (self as any).add(makeWhen(makeOrPredicate(patterns), onMatch))
307}
308
309/** @internal */
310export const whenAnd = <

Callers

nothing calls this directly

Calls 3

makeWhenFunction · 0.85
makeOrPredicateFunction · 0.85
addMethod · 0.65

Tested by

no test coverage detected