Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aaronshaf/callbag-flatten-iter
Callbag operator that flattens iterables
https://github.com/aaronshaf/callbag-flatten-iter
Last synced: about 1 month ago
JSON representation
Callbag operator that flattens iterables
- Host: GitHub
- URL: https://github.com/aaronshaf/callbag-flatten-iter
- Owner: aaronshaf
- License: mit
- Created: 2018-02-06T04:52:02.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-04T18:39:56.000Z (over 6 years ago)
- Last Synced: 2024-10-23T20:44:14.162Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 7.81 KB
- Stars: 3
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-callbags - flatten-iter
README
```
yarn add callbag-flatten-iter
``````javascript
const pipe = require("callbag-pipe");
const fromIter = require("callbag-from-iter");
const flattenIter = require("callbag-flatten-iter");
const forEach = require("callbag-for-each");pipe(
fromIter([[10], [20], [30], [40, 50, 60]]),
flattenIter,
forEach(i => {
// called 6 times
})
);
```If you're blessed with the [pipeline operator](https://github.com/tc39/proposal-pipeline-operator):
```javascript
fromIter([[10], [20], [30], [40, 50, 60]])
|> flattenIter
|> forEach(i => {
// called 6 times
});
```## Learn more
* [Callbag basics](https://github.com/staltz/callbag-basics)
* [Why we need callbags](https://staltz.com/why-we-need-callbags.html), by André Staltz