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:
616 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | import { reject } from 'ramda';
|
---|
| 2 |
|
---|
| 3 | import isFalsy from './isFalsy';
|
---|
| 4 |
|
---|
| 5 | /**
|
---|
| 6 | * Creates an array with all falsy values removed.
|
---|
| 7 | * The values false, null, 0, "", undefined, and NaN are falsy.
|
---|
| 8 | *
|
---|
| 9 | * @func compact
|
---|
| 10 | * @memberOf RA
|
---|
| 11 | * @since {@link https://char0n.github.io/ramda-adjunct/2.5.0|v2.5.0}
|
---|
| 12 | * @category List
|
---|
| 13 | * @sig Filterable f => f a -> f a
|
---|
| 14 | * @param {Array} list The array to compact
|
---|
| 15 | * @return {Array} Returns the new array of filtered values
|
---|
| 16 | * @see {@link RA.isFalsy|isFalsy}
|
---|
| 17 | * @example
|
---|
| 18 | *
|
---|
| 19 | * RA.compact([0, 1, false, 2, '', 3]); //=> [1, 2, 3]
|
---|
| 20 | */
|
---|
| 21 | const compact = reject(isFalsy);
|
---|
| 22 |
|
---|
| 23 | export default compact;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.