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:
1.2 KB
|
Line | |
---|
1 | var _curry1 =
|
---|
2 | /*#__PURE__*/
|
---|
3 | require("./internal/_curry1.js");
|
---|
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(
|
---|
25 | * R.repeat(' '),
|
---|
26 | * R.join(''),
|
---|
27 | * R.replace(/^(?!$)/gm)
|
---|
28 | * );
|
---|
29 | *
|
---|
30 | * const format = R.converge(
|
---|
31 | * R.call,
|
---|
32 | * [
|
---|
33 | * R.pipe(R.prop('indent'), indentN),
|
---|
34 | * R.prop('value')
|
---|
35 | * ]
|
---|
36 | * );
|
---|
37 | *
|
---|
38 | * format({indent: 2, value: 'foo\nbar\nbaz\n'}); //=> ' foo\n bar\n baz\n'
|
---|
39 | * @symb R.call(f, a, b) = f(a, b)
|
---|
40 | */
|
---|
41 |
|
---|
42 |
|
---|
43 | var call =
|
---|
44 | /*#__PURE__*/
|
---|
45 | _curry1(function call(fn) {
|
---|
46 | return fn.apply(this, Array.prototype.slice.call(arguments, 1));
|
---|
47 | });
|
---|
48 |
|
---|
49 | module.exports = call; |
---|
Note:
See
TracBrowser
for help on using the repository browser.