main
Last change
on this file since 65b6638 was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
957 bytes
|
Line | |
---|
1 | import { append, flip } from 'ramda';
|
---|
2 |
|
---|
3 | /**
|
---|
4 | * Returns a new list containing the contents of the given list, followed by the given element.
|
---|
5 | * Like {@link http://ramdajs.com/docs/#append|R.append} but with argument order reversed.
|
---|
6 | *
|
---|
7 | * @func appendFlipped
|
---|
8 | * @memberOf RA
|
---|
9 | * @since {@link https://char0n.github.io/ramda-adjunct/2.5.0|v2.5.0}
|
---|
10 | * @category List
|
---|
11 | * @sig [a] -> a -> [a]
|
---|
12 | * @param {Array} list The list of elements to add a new item to
|
---|
13 | * @param {*} el The element to add to the end of the new list
|
---|
14 | * @return {Array} A new list containing the elements of the old list followed by `el`
|
---|
15 | * @see {@link http://ramdajs.com/docs/#append|R.append}
|
---|
16 | * @example
|
---|
17 | *
|
---|
18 | * RA.appendFlipped(['write', 'more'], 'tests'); //=> ['write', 'more', 'tests']
|
---|
19 | * RA.appendFlipped([], 'tests'); //=> ['tests']
|
---|
20 | * RA.appendFlipped(['write', 'more'], ['tests']); //=> ['write', 'more', ['tests']]
|
---|
21 | */
|
---|
22 | const appendFlipped = flip(append);
|
---|
23 |
|
---|
24 | export default appendFlipped;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.