plainfp - v0.1.1
    Preparing search index...

    Function value

    • Bind a pure computed field onto the builder scope. fn receives the accumulated scope and returns a plain value — it never fails and never widens the error type.

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

      Type Parameters

      • S
      • E1
      • N extends string
      • A

      Parameters

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

      pipe(
      build(),
      field("order", () => loadOrder(id)),
      value("total", ({ order }) => order.items.reduce(sum, 0)),
      map(({ total }) => total),
      )
    • Bind a pure computed field onto the builder scope. fn receives the accumulated scope and returns a plain value — it never fails and never widens the error type.

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

      Type Parameters

      • S
      • N extends string
      • A

      Parameters

      • name: N
      • fn: (scope: S) => A

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

      pipe(
      build(),
      field("order", () => loadOrder(id)),
      value("total", ({ order }) => order.items.reduce(sum, 0)),
      map(({ total }) => total),
      )