zip() and zipWith() for Node.js!

npm install zippy
1 downloads in the last day
9 downloads in the last week
27 downloads in the last month


zippy is a tiny library that implements the zip and the more general zipWith. It was factored out of the "hempwick" project, since it's the only part of it I've used regularly and the project was too big for me to maintain.


npm install zippy


zip(xs, ys, ...)

Returns a list with elements (x_i, y_i, ...). For example:

>[1, 2, 3], [1, 4, 9])
[[1, 1], [2, 4], [3, 9]]

zip may take more than two arguments.


> var transpose = function(a) { return, M); };

zipWith(fxn, xs, ys, ...)

zipWith is a more general form of zip, which takes a function that "does something" with each set of x_i, y_i. In fact, zip is implemented with zipWith! For an example:

> zippy.zipWith(function(x,y) {return x+y;}, [1, 2, 3], [3, 2, 1])
[4, 4, 4]


npm test

Pull requests?

Why yes, I would be interested!



npm loves you