Skip to content

apply() function

Applies function f to the argument list args.

Signature:

typescript
declare function apply<F extends Arrow, T extends Parameters<F>>(f: F): (args: T) => ReturnType<typeof f>;

Example

ts
apply(Math.max, [1, 2, 3, 4, 5]); // 5

pipe(
  repeat(10),
  map(a => a * Math.random())
  take(5),
  apply(max)
);

Open Source Code

Released under the Apache-2.0 License.