Gen Iter is a javascript library providing lazy iterable utilities backed by generators.


Keywords
generator, iterator, lazy, collection, array
License
LGPL-3.0-only
Install
npm install gen-iter@0.2.0

Documentation

Gen Iter

Gen Iter is a javascript library providing lazy iterable utilities backed by generators.

Installation

npm:

npm install --save gen-iter

yarn:

yarn add gen-iter

Usage

Example:

// result === [6, 12, 18, 24, 30]
const result = pipe(
  successor(0, v => v + 1), // yields 1, 2, 3, 4, ...
  r => map(r, v => v * 2), // yields 2, 4, 6, 8, ...
  r => filter(r, v => v % 3 === 0), // yields 6, 12, 18, 24, ...
  r => take(r, 5), // yields 6, 12, 18, 24, 30
  r => Array.from(r) // returns [6, 12, 18, 24, 30]
)

For the full documentation please visit the website.