UNPKG

843 BJavaScriptView Raw
1var _curry2 =
2/*#__PURE__*/
3require("./internal/_curry2");
4/**
5 * Applies function `fn` to the argument list `args`. This is useful for
6 * creating a fixed-arity function from a variadic function. `fn` should be a
7 * bound function if context is significant.
8 *
9 * @func
10 * @memberOf R
11 * @since v0.7.0
12 * @category Function
13 * @sig (*... -> a) -> [*] -> a
14 * @param {Function} fn The function which will be called with `args`
15 * @param {Array} args The arguments to call `fn` with
16 * @return {*} result The result, equivalent to `fn(...args)`
17 * @see R.call, R.unapply
18 * @example
19 *
20 * const nums = [1, 2, 3, -99, 42, 6, 7];
21 * R.apply(Math.max, nums); //=> 42
22 * @symb R.apply(f, [a, b, c]) = f(a, b, c)
23 */
24
25
26var apply =
27/*#__PURE__*/
28_curry2(function apply(fn, args) {
29 return fn.apply(this, args);
30});
31
32module.exports = apply;
\No newline at end of file