npm install ai-filter

> Filter over async iterables.
This method creates a new async iterable with all elements that pass the test
implemented by the provided function.
**This module is part of
Async iterable fun, a complete toolset of
modules to work with async iterables.**
This example read a text file, filtering only chunks containing a new line:
``js
import filter from 'ai-filter';
import { createReadStream } from "fs";
const stream = createReadStream(file.txt, "utf8");`
const result = filter(chunk => chunk.contains('\n'), fromStream(stream))
for await (const chunk of result) {
console.log(chunk);
}
The filter() method creates a new async iterable with all elements that pass the
test implemented by the provided function.
Parameters
* predicate
Function
is a predicate, to test each element of the async iterable. Return true to
keep the element, false otherwise, taking three arguments:
``
element: The current element being processed in the async iterable.
index: The index of the current element being processed in the async iterable.
iterable: The async iterable filter was called upon.
* data AsyncIterable The source async iterable to filter.
Returns AsyncIterable A new async iterable with the elements that pass the
test.
With npm installed, run
`bash`
npm install --save ai-filter
* noffle/common-readme
* parro-it/ai-fun`
MIT