29 lines
826 B
JavaScript
29 lines
826 B
JavaScript
import _curry2 from "./internal/_curry2.js";
|
|
/**
|
|
* Applies function `fn` to the argument list `args`. This is useful for
|
|
* creating a fixed-arity function from a variadic function. `fn` should be a
|
|
* bound function if context is significant.
|
|
*
|
|
* @func
|
|
* @memberOf R
|
|
* @since v0.7.0
|
|
* @category Function
|
|
* @sig (*... -> a) -> [*] -> a
|
|
* @param {Function} fn The function which will be called with `args`
|
|
* @param {Array} args The arguments to call `fn` with
|
|
* @return {*} result The result, equivalent to `fn(...args)`
|
|
* @see R.call, R.unapply
|
|
* @example
|
|
*
|
|
* const nums = [1, 2, 3, -99, 42, 6, 7];
|
|
* R.apply(Math.max, nums); //=> 42
|
|
* @symb R.apply(f, [a, b, c]) = f(a, b, c)
|
|
*/
|
|
|
|
var apply =
|
|
/*#__PURE__*/
|
|
_curry2(function apply(fn, args) {
|
|
return fn.apply(this, args);
|
|
});
|
|
|
|
export default apply; |