Wu.js
Wu.js by Nick Fitzgerald is a lazy functional library for JavaScript. Wu.js makes it easy to work with lazy iterators and compose functions from functional methods like curry.
Basic usage involves calling wu() on an object, then calling a chained sequence of methods:
wu([[0,2], [1,2], [2,2], [3,2]]).mapply(Math.pow).toArray();
If you’re familiar with lazy iterators in languages like Clojure, you’ll appreciate the lazy methods. Sequences can be created with methods like cycle, and then processed with .takeWhile(), .asyncEach(), or .next().
The Lego functions are also interesting:
function square(x) { return x * x; }
function add2(x) { return x + 2; }
wu.compose(square, add2)(5);
// 49
wu.compose(add2, square)(5);
// 27
The GitHub page is here: fitzgen/wu.js.
