Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/staltz/callbag-skip
👜 Callbag operator that skips the first N data points of a source
https://github.com/staltz/callbag-skip
Last synced: 5 days ago
JSON representation
👜 Callbag operator that skips the first N data points of a source
- Host: GitHub
- URL: https://github.com/staltz/callbag-skip
- Owner: staltz
- License: mit
- Created: 2018-01-29T10:52:18.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-12-28T12:42:02.000Z (about 3 years ago)
- Last Synced: 2024-12-24T20:38:16.847Z (20 days ago)
- Language: JavaScript
- Homepage:
- Size: 7.81 KB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
- awesome-callbags - skip
README
# callbag-skip
Callbag operator that skips the first N data points of a source. Works on either pullable and listenable sources.
`npm install callbag-skip`
## example
On a listenable source:
```js
const interval = require('callbag-interval');
const forEach = require('callbag-for-each');
const skip = require('callbag-skip');const source = skip(3)(interval(1000));
forEach(x => console.log(x))(source); // 3
// 4
// 5
// 6
// ...
```On a pullable source:
```js
const fromIter = require('callbag-from-iter');
const forEach = require('callbag-for-each');
const skip = require('callbag-skip');function* range(from, to) {
let i = from;
while (i <= to) {
yield i;
i++;
}
}const source = skip(4)(fromIter(range(10, 20)));
forEach(x => console.log(x))(source); // 14
// 15
// 16
// 17
// 18
// 19
// 20
```