Skip to content

apply() function

인자 목록 args에 함수 f를 적용합니다.

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.