Function
Static Public Summary | ||
public |
* compress(iterable: Iterable, selector: Iterable): Iterator Filters the first input iterable according to truthy and flasy values from a second input iterable. |
|
public |
Yields all elements from input iterable that verify a given predicate. |
|
public |
* filterfalse(predicate: Function, iterable: Iterable): IterableIterator Yields all elements from input iterable that do not verify a given predicate. |
Static Public
public * compress(iterable: Iterable, selector: Iterable): Iterator source
import compress from '@iterable-iterator/filter/src/compress.js'
Filters the first input iterable according to truthy and flasy values from a second input iterable. The ith element of the first input iterable is output if and only if the ith element of the second input iterable is truthy.
Params:
Name | Type | Attribute | Description |
iterable | Iterable | The first input iterable to filter. |
|
selector | Iterable | The second input iterable containing the truthy and falsy values. |
Return:
Iterator |
public * filter(predicate: Function, iterable: Iterable): IterableIterator source
import filter from '@iterable-iterator/filter/src/filter.js'
Yields all elements from input iterable that verify a given predicate.
Params:
Name | Type | Attribute | Description |
predicate | Function | A unary function that returns a truthy or falsy value. |
|
iterable | Iterable | The input iterable. |
Return:
IterableIterator |
Example:
// returns [ 1 , 3 , 5 , 7 , 9 ]
list( filter( x => x % 2 , range( 10 ) ) ) ;
public * filterfalse(predicate: Function, iterable: Iterable): IterableIterator source
import filterfalse from '@iterable-iterator/filter/src/filterfalse.js'
Yields all elements from input iterable that do not verify a given predicate.
Params:
Name | Type | Attribute | Description |
predicate | Function | A unary function that returns a truthy or falsy value. |
|
iterable | Iterable | The input iterable. |
Return:
IterableIterator |
Example:
// returns [ 0 , 2 , 4 , 6 , 8 ]
list( filter( x => x % 2 , range( 10 ) ) ) ;