source: node_modules/ramda/es/unapply.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: 889 bytes
Line 
1import _curry1 from "./internal/_curry1.js";
2/**
3 * Takes a function `fn`, which takes a single array argument, and returns a
4 * function which:
5 *
6 * - takes any number of positional arguments;
7 * - passes these arguments to `fn` as an array; and
8 * - returns the result.
9 *
10 * In other words, `R.unapply` derives a variadic function from a function which
11 * takes an array. `R.unapply` is the inverse of [`R.apply`](#apply).
12 *
13 * @func
14 * @memberOf R
15 * @since v0.8.0
16 * @category Function
17 * @sig ([*...] -> a) -> (*... -> a)
18 * @param {Function} fn
19 * @return {Function}
20 * @see R.apply
21 * @example
22 *
23 * R.unapply(JSON.stringify)(1, 2, 3); //=> '[1,2,3]'
24 * @symb R.unapply(f)(a, b) = f([a, b])
25 */
26
27var unapply =
28/*#__PURE__*/
29_curry1(function unapply(fn) {
30 return function () {
31 return fn(Array.prototype.slice.call(arguments, 0));
32 };
33});
34
35export default unapply;
Note: See TracBrowser for help on using the repository browser.