lazymap
v1.0.1
Published
lazy evaluate array processing, do only what you need
Downloads
1
Readme
Lazymap
Lazy evaluate array processing, do only what you need.
Install
npm i lazymap -S
Example
const lazy = require('lazy');
const squad = require('squad');
const fn = squad.apply(...[
a => `hello ${a}`,
a => String(a),
a => ++a,
a => a * a
]);
const take = lazy(fn, [1, 2, 3, 4, 5]);
take(2);
// returns
[ 'hello 2', 'hello 5']
Environments
Node.js
In old node.js
environments that supports es5
only, lazymap
could be used with:
var lazymap = require('lazymap/legacy');
Web Browser
lazymap
could be installed via bower
with:
bower install lazymap --save
When loaded in browser lazymap
uses global variable with same name (when browserify
or webpack
did not used).
License
MIT