Skip to content

apply() function

関数 f を引数リスト 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.