UNPKG

906 BJavaScriptView Raw
1var _curry1 =
2/*#__PURE__*/
3require("./internal/_curry1");
4/**
5 * Takes a function `fn`, which takes a single array argument, and returns a
6 * function which:
7 *
8 * - takes any number of positional arguments;
9 * - passes these arguments to `fn` as an array; and
10 * - returns the result.
11 *
12 * In other words, `R.unapply` derives a variadic function from a function which
13 * takes an array. `R.unapply` is the inverse of [`R.apply`](#apply).
14 *
15 * @func
16 * @memberOf R
17 * @since v0.8.0
18 * @category Function
19 * @sig ([*...] -> a) -> (*... -> a)
20 * @param {Function} fn
21 * @return {Function}
22 * @see R.apply
23 * @example
24 *
25 * R.unapply(JSON.stringify)(1, 2, 3); //=> '[1,2,3]'
26 * @symb R.unapply(f)(a, b) = f([a, b])
27 */
28
29
30var unapply =
31/*#__PURE__*/
32_curry1(function unapply(fn) {
33 return function () {
34 return fn(Array.prototype.slice.call(arguments, 0));
35 };
36});
37
38module.exports = unapply;
\No newline at end of file