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

Function whenOr

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

Source from the content-addressed store, hash-verified

268
269/** @internal */
270export const whenOr = <
271 R,
272 const P extends ReadonlyArray<
273 Types.PatternPrimitive<R> | Types.PatternBase<R>
274 >,
275 Ret,
276 Fn extends (_: Types.WhenMatch<R, P[number]>) => Ret
277>(
278 ...args: [...patterns: P, f: Fn]
279) =>
280<I, F, A, Pr>(
281 self: Matcher<I, F, R, A, Pr, Ret>
282): Matcher<
283 I,
284 Types.AddWithout<F, Types.PForExclude<P[number]>>,
285 Types.ApplyFilters<I, Types.AddWithout<F, Types.PForExclude<P[number]>>>,
286 A | ReturnType<Fn>,
287 Pr,
288 Ret
289> => {
290 const onMatch = args[args.length - 1] as any
291 const patterns = args.slice(0, -1) as unknown as P
292 return (self as any).add(makeWhen(makeOrPredicate(patterns), onMatch))
293}
294
295/** @internal */
296export const whenAnd = <

Callers

nothing calls this directly

Calls 3

makeWhenFunction · 0.85
makeOrPredicateFunction · 0.85
addMethod · 0.65

Tested by

no test coverage detected