5 ms·
Check out node-lazy, it does something similar and more nicely: https://github.com/pkrumins/node-lazy https://github.com/pkrumins/node-lazy var Lazy = requ
by pkrumins 15y ago
Check out node-lazy, it does something similar and more nicely: https://github.com/pkrumins/node-lazy https://github.com/pkrumins/node-lazy
var Lazy = require('lazy');
Lazy.range('1..') // infinite list of integers (see readme)
.filter(function (n) {
return n % 5 == 0
})
.take(5)
.join(function (result) {
console.log(result)
})
;
Output:
[ 5, 10, 15, 20, 25 ]