1 | var curry =
|
2 | /*#__PURE__*/
|
3 | require("./curry");
|
4 | /**
|
5 | * Returns the result of calling its first argument with the remaining
|
6 | * arguments. This is occasionally useful as a converging function for
|
7 | * [`R.converge`](#converge): the first branch can produce a function while the
|
8 | * remaining branches produce values to be passed to that function as its
|
9 | * arguments.
|
10 | *
|
11 | * @func
|
12 | * @memberOf R
|
13 | * @since v0.9.0
|
14 | * @category Function
|
15 | * @sig (*... -> a),*... -> a
|
16 | * @param {Function} fn The function to apply to the remaining arguments.
|
17 | * @param {...*} args Any number of positional arguments.
|
18 | * @return {*}
|
19 | * @see R.apply
|
20 | * @example
|
21 | *
|
22 | * R.call(R.add, 1, 2); //=> 3
|
23 | *
|
24 | * const indentN = R.pipe(R.repeat(' '),
|
25 | * R.join(''),
|
26 | * R.replace(/^(?!$)/gm));
|
27 | *
|
28 | * const format = R.converge(R.call, [
|
29 | * R.pipe(R.prop('indent'), indentN),
|
30 | * R.prop('value')
|
31 | * ]);
|
32 | *
|
33 | * format({indent: 2, value: 'foo\nbar\nbaz\n'}); //=> ' foo\n bar\n baz\n'
|
34 | * @symb R.call(f, a, b) = f(a, b)
|
35 | */
|
36 |
|
37 |
|
38 | var call =
|
39 | /*#__PURE__*/
|
40 | curry(function call(fn) {
|
41 | return fn.apply(this, Array.prototype.slice.call(arguments, 1));
|
42 | });
|
43 | module.exports = call; |
\ | No newline at end of file |