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:
909 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | var _curry1 =
|
---|
| 2 | /*#__PURE__*/
|
---|
| 3 | require("./internal/_curry1.js");
|
---|
| 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 |
|
---|
| 30 | var unapply =
|
---|
| 31 | /*#__PURE__*/
|
---|
| 32 | _curry1(function unapply(fn) {
|
---|
| 33 | return function () {
|
---|
| 34 | return fn(Array.prototype.slice.call(arguments, 0));
|
---|
| 35 | };
|
---|
| 36 | });
|
---|
| 37 |
|
---|
| 38 | module.exports = unapply; |
---|
Note:
See
TracBrowser
for help on using the repository browser.