I'd like to zip together a count with an array. It seems something like this would be the most elegant way of doing it Lazy([...]).zip(Lazy.range(1, Infinity))
. But it doesn't produce the result I expect. Here is a unit test:
var assert = require('assert');
var Lazy = require('lazy.js');
describe('Lazy', () => {
describe('#zip()', () => {
it('can zip with infinite range', () => {
assert.deepEqual([['a', 1], ['b', 2]],
Lazy(['a', 'b']).zip(Lazy.range(1, Infinity)).toArray());
});
});
});
It fails with the following error:
AssertionError: [ [ 'a', 'b' ], [ 1, 2 ] ] deepEqual [ [ 'a', undefined ], [ 'b', undefined ] ]