Iterable filtering functions for JavaScript. See docs.
⚠️ Depending on your environment, the code may requireregeneratorRuntime
to be defined, for instance by importing regenerator-runtime/runtime.
import {count} from '@iterable-iterator/count';
import {filter, filterfalse} from '@iterable-iterator/filter';
import {divisible} from '@functional-abstraction/predicate';
filter( divisible( 2 ) , count( 0 , 1 ) ) ; // 0 2 4 8 ...
filterfalse( divisible( 2 ) , count( 0 , 1 ) ) ; // 1 3 5 7 ...
import {cycle} from '@iterable-iterator/cycle';
import {compress} from '@iterable-iterator/filter';
compress( count( 0 , 1 ) , cycle( [ true , false ] ) ) ; // 0 2 4 6 ...