An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# `xstream-tuplewise`

![npm](https://img.shields.io/npm/v/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