MCPcopy Create free account
hub / github.com/contentlayerdev/contentlayer / foldM

Function foldM

packages/@contentlayer/utils/src/effect/These.ts:51–57  ·  view source on GitHub ↗
(
  onSuccess: (a: A) => These<E1, A1>,
  onBoth: (a: A, e: E) => These<E2, A2>,
  onFail: (e: E) => These<E3, A3>,
)

Source from the content-addressed store, hash-verified

49}
50
51export function foldM<E, A, E1, A1, E2, A2, E3, A3>(
52 onSuccess: (a: A) => These<E1, A1>,
53 onBoth: (a: A, e: E) => These<E2, A2>,
54 onFail: (e: E) => These<E3, A3>,
55) {
56 return (self: These<E, A>): These<E1 | E2 | E3, A1 | A2 | A3> => foldM_(self, onSuccess, onBoth, onFail)
57}
58
59export function map_<E, A0, A>(self: These<E, A0>, f: (a: A0) => A) {
60 return foldM_(

Callers

nothing calls this directly

Calls 1

foldM_Function · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…