https://github.com/ryota-ka/xstream-tuplewise
An xstream operator that groups consecutive events into N-tuples
https://github.com/ryota-ka/xstream-tuplewise
xstream xstream-operator
Last synced: about 1 year ago
JSON representation
An xstream operator that groups consecutive events into N-tuples
- Host: GitHub
- URL: https://github.com/ryota-ka/xstream-tuplewise
- Owner: ryota-ka
- Created: 2020-10-25T13:56:32.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-25T14:27:25.000Z (over 5 years ago)
- Last Synced: 2025-03-12T07:55:34.607Z (over 1 year ago)
- Topics: xstream, xstream-operator
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/xstream-tuplewise
- Size: 62.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `xstream-tuplewise`

An xstream operator that groups consecutive events into N-tuples
```typescript
function tuplewise(n: N): ($: Stream) => Stream;
```
## Installation
Note that [`xstream`](https://www.npmjs.com/package/xstream) is a peer dependencies of this library, which need to be installed separately.
### Using [`npm`](https://www.npmjs.com/)
```
$ npm install xstream-tuplewise
```
### Using [`yarn`](https://yarnpkg.com/)
```
$ yarn add xstream-tuplewise
```
## Example
### `tuplewise(0)`
```
---0---1-------2-------3-----------4--------|
tuplewise(0)
[]-[]--[]------[]------[]----------[]-------|
```
### `tuplewise(1)`
```
---0---1-------2-------3-----------4--------|
tuplewise(1)
---[0]-[1]-----[2]-----[3]---------[4]------|
```
### `tuplewise(2)`
```
---0---1-------2-------3-----------4--------|
tuplewise(2)
-------[0,1]---[1,2]---[2,3]-------[3,4]----|
```
### `tuplewise(3)`
```
---0---1-------2-------3-----------4--------|
tuplewise(3)
---------------[0,1,2]-[1,2,3]-----[2,3,4]--|
```
## License
MIT