source: node_modules/ramda/es/apply.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 826 bytes
Line 
1import _curry2 from "./internal/_curry2.js";
2/**
3 * Applies function `fn` to the argument list `args`. This is useful for
4 * creating a fixed-arity function from a variadic function. `fn` should be a
5 * bound function if context is significant.
6 *
7 * @func
8 * @memberOf R
9 * @since v0.7.0
10 * @category Function
11 * @sig (*... -> a) -> [*] -> a
12 * @param {Function} fn The function which will be called with `args`
13 * @param {Array} args The arguments to call `fn` with
14 * @return {*} result The result, equivalent to `fn(...args)`
15 * @see R.call, R.unapply
16 * @example
17 *
18 * const nums = [1, 2, 3, -99, 42, 6, 7];
19 * R.apply(Math.max, nums); //=> 42
20 * @symb R.apply(f, [a, b, c]) = f(a, b, c)
21 */
22
23var apply =
24/*#__PURE__*/
25_curry2(function apply(fn, args) {
26 return fn.apply(this, args);
27});
28
29export default apply;
Note: See TracBrowser for help on using the repository browser.