xstream-tuplewise
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

xstream-tuplewise

npm

An xstream operator that groups consecutive events into N-tuples

function tuplewise<N extends number, T>(n: N): ($: Stream<T>) => Stream<T[] & { length: N }>;

Installation

Note that xstream is a peer dependencies of this library, which need to be installed separately.

Using npm

$ npm install xstream-tuplewise

Using yarn

$ 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

Readme

Keywords

Package Sidebar

Install

npm i xstream-tuplewise

Weekly Downloads

6

Version

0.1.0

License

MIT

Unpacked Size

3.26 kB

Total Files

4

Last publish

Collaborators

  • ryota-ka