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

how about a simple range generator? #110

Open
jmagaram opened this issue Feb 22, 2021 · 1 comment
Open

how about a simple range generator? #110

jmagaram opened this issue Feb 22, 2021 · 1 comment

Comments

@jmagaram
Copy link

I've come from C# and like your project. Couldn't find much out there (in TypeScript) like it - mystified by that! Would love to see just a simple fromRange(start:number, end:number) and maybe fromInfinite() to get me started. Or is there already some way to do that?

@tomi
Copy link
Owner

tomi commented Mar 6, 2021

Hi @jmagaram and thank you for your interest towards the project. That's an interesting idea. Currently it's not possible to do that with fromfrom. I think that should be quite easy to implement using a generator function:

function* range(start: number, end: number) {
  while (start < end) {
    yield start;
    start++;
  }
}

then you could use that with fromfrom

from(range(5, 10))
  .map(i => i * 2)
  .toArray()

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

2 participants