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:
863 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | import { converge, length, identity } from 'ramda';
|
---|
| 2 |
|
---|
| 3 | import curryRightN from './curryRightN';
|
---|
| 4 |
|
---|
| 5 | /**
|
---|
| 6 | * Returns a curried equivalent of the provided function.
|
---|
| 7 | * This function is like curry, except that the provided arguments order is reversed.
|
---|
| 8 | *
|
---|
| 9 | * @func curryRight
|
---|
| 10 | * @memberOf RA
|
---|
| 11 | * @since {@link https://char0n.github.io/ramda-adjunct/1.12.0|v1.12.0}
|
---|
| 12 | * @category Function
|
---|
| 13 | * @sig (* -> a) -> (* -> a)
|
---|
| 14 | * @param {Function} fn The function to curry
|
---|
| 15 | * @return {Function} A new, curried function
|
---|
| 16 | * @see {@link http://ramdajs.com/docs/#curry|R.curry}, {@link RA.curryRightN|curryRightN}
|
---|
| 17 | * @example
|
---|
| 18 | *
|
---|
| 19 | * const concatStrings = (a, b, c) => a + b + c;
|
---|
| 20 | * const concatStringsCurried = RA.curryRight(concatStrings);
|
---|
| 21 | *
|
---|
| 22 | * concatStringCurried('a')('b')('c'); // => 'cba'
|
---|
| 23 | */
|
---|
| 24 | const curryRight = converge(curryRightN, [length, identity]);
|
---|
| 25 |
|
---|
| 26 | export default curryRight;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.