plainfp - v0.1.1
    Preparing search index...

    Function field

    • Bind a step that may be absent onto the builder scope. fn receives the accumulated scope and returns an Option; on none the chain short-circuits and later steps are skipped.

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

      Type Parameters

      • S
      • N extends string
      • A

      Parameters

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

      pipe(
      build(),
      field("token", () => fromNullable(getToken(sym))),
      field("price", ({ token }) => fromNullable(token.price)),
      map(({ price }) => price),
      )
    • Bind a step that may be absent onto the builder scope. fn receives the accumulated scope and returns an Option; on none the chain short-circuits and later steps are skipped.

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

      Type Parameters

      • S
      • N extends string
      • A

      Parameters

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

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