Start sharing components as a team!Share components as a team!Join Bit to build your applications faster.Get Started Free

filter

v0.26.1arrow_drop_down
v0.26.1
STATUS
Passing
DOWNLOADS
470
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
8 months ago
SIZE
2 KB
Takes a predicate and a `Filterable`, and returns a new filterable of the
1 contributor
Use filter in your project ?
Copied
npm i @bit/ramda.ramda.filter
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.dev
Component Example
React
React
Vue
Angular
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
revert changes
reload
toggle layout
maximize
filter(isEven, [1, 2, 3, 4]);
modifieddraft
chevron_left
chevron_right
filter (
pred:Function,
filterable:Array
) : Array

Takes a predicate and a Filterable, and returns a new filterable of the same type containing the members of the given filterable which satisfy the given predicate. Filterable objects include plain objects or any object that has a filter method such as Array.

Dispatches to the filter method of the second argument, if present.

Acts as a transducer if a transformer is given in list position.

Example
const isEven = n => n % 2 === 0;

     R.filter(isEven, [1, 2, 3, 4]); //=> [2, 4]

     R.filter(isEven, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4}
Arguments
pred: Function
filterable: Array
Returns
Array

Filterable