Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reverse Series Iterator #3

Closed
blond opened this issue Jun 3, 2016 · 2 comments
Closed

Reverse Series Iterator #3

blond opened this issue Jun 3, 2016 · 2 comments

Comments

@blond
Copy link
Owner

blond commented Jun 3, 2016

Returns a Iterator, that traverses iterators in reverse order.

This is reminiscent of the concatenation with reverse of arrays.

Example:

const reverseSeries = require('ho-iter').reverseSeries;

const arr1 = [1, 2];
const arr2 = [3, 4];

const set1 = new Set([1, 2]);
const set2 = new Set([3, 4]);

[].concat(arr1, arr2).reverse(); // [4, 3, 2, 1]

for (let item of reverseSeries(set1, set2)) { console.log(item) } // 4 3 2 1
@blond
Copy link
Owner Author

blond commented Jul 3, 2016

If you need reverse some iterators you can use series with reverse methods.

Example:

const series = require('ho-iter').series;
const reverse = require('ho-iter').reverse;

const set1 = new Set([1, 2]);
const set2 = new Set([3, 4]);

const iter = series(set1, set2); // 1, 2, 3, 4
const reversedIter = reverse(iter); // 4, 3, 2, 1

@blond
Copy link
Owner Author

blond commented Jul 3, 2016

Closed in favor of #10

@blond blond closed this as completed Jul 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant