lazy-piping
v1.1.10
Published
A lazy piping operator for iterators
Downloads
10
Readme
Lazy Piping
A tiny package to allow lazy operations on all iterators. The whole point of this package is to allow saving of operations and the only calculating when needed (by calling the .get()
function).
Just type into the terminal:
npm install --save lazy-piping
Then, in your code itself:
const { from, map, filter } = require('lazy-piping');
or:
import { from, map, filter } from 'lazy-piping';
or (as a script in your HTML):
<script src="https://unpkg.com/lazy-piping@latest/packages/lazy-piping.umd/src/index.js"></script>
const { from, map, filter } = LazyPiping;
And you're good to go!
from([1, 2, 3, 4, 5, 6, 7, 8])
.pipe(
map(x => x * 2),
filter(x => x % 3)
)
.get();
Happy iterating! ;)