plainfp - v0.1.1
    Preparing search index...

    Function field

    • Bind a fallible step onto the builder scope. fn receives the accumulated scope and returns a Result; 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 ResultType<
          {
              [K in string
              | number
              | symbol]: (Omit<S, N> & { readonly [K in string]: A })[K]
          },
          E1
          | E2,
      >

      pipe(
      build(),
      field("token", () => fromNullable(getToken(sym), notFound)),
      field("price", ({ token }) => fromNullable(token.price, noPrice)),
      map(({ price }) => price),
      )
    • Bind a fallible step onto the builder scope. fn receives the accumulated scope and returns a Result; 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: ResultType<S, E1>,
      ) => ResultType<
          {
              [K in string
              | number
              | symbol]: (Omit<S, N> & { readonly [K in string]: A })[K]
          },
          E2
          | E1,
      >

      pipe(
      build(),
      field("token", () => fromNullable(getToken(sym), notFound)),
      field("price", ({ token }) => fromNullable(token.price, noPrice)),
      map(({ price }) => price),
      )