plainfp - v0.1.1
    Preparing search index...

    Function field

    • Bind a fallible async step onto the builder scope. fn receives the accumulated scope and returns a ResultAsync; it is awaited and, on err, the chain short-circuits and later steps are skipped. The error channel widens to the union of all bound steps.

      Dual API — works data-first or curried for use in pipe.

      Type Parameters

      • S
      • E1
      • N extends string
      • A
      • E2

      Parameters

      Returns ResultAsyncType<
          {
              [K in string
              | number
              | symbol]: (Omit<S, N> & { readonly [K in string]: A })[K]
          },
          E1
          | E2,
      >

      pipe(
      build(),
      field("user", () => fetchUser(id)),
      field("plan", ({ user }) => fetchPlan(user.planId)),
      map(({ plan }) => plan),
      )
    • Bind a fallible async step onto the builder scope. fn receives the accumulated scope and returns a ResultAsync; it is awaited and, on err, the chain short-circuits and later steps are skipped. The error channel widens to the union of all bound steps.

      Dual API — works data-first or curried for use in pipe.

      Type Parameters

      • S
      • N extends string
      • A
      • E2

      Parameters

      Returns <E1>(
          acc: ResultAsyncType<S, E1>,
      ) => ResultAsyncType<
          {
              [K in string
              | number
              | symbol]: (Omit<S, N> & { readonly [K in string]: A })[K]
          },
          E2
          | E1,
      >

      pipe(
      build(),
      field("user", () => fetchUser(id)),
      field("plan", ({ user }) => fetchPlan(user.planId)),
      map(({ plan }) => plan),
      )