source: node_modules/ramda-adjunct/src/compact.js

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
Line 
1import { reject } from 'ramda';
2
3import 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 */
21const compact = reject(isFalsy);
22
23export default compact;
Note: See TracBrowser for help on using the repository browser.