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

add find method to generators #45

Merged
merged 1 commit into from
Dec 3, 2017
Merged

Conversation

ssartell
Copy link
Contributor

@ssartell ssartell commented Dec 2, 2017

This pull request adds a basic find method to all generators.

@atavakoli
Copy link
Contributor

Since generators may theoretically yield an infinite number of terms, can this lead to an infinite loop? Could there be a max number of iterations also passed in, where it would return undefined if the search didn't succeed within the specified number of terms?

I don't think this is an actual issue with any of the existing generators, which all generate a finite amount of terms, and none of the other iteration methods deal with this. But for very large sequences, having a way to exit early would be useful to keep applications responsive, without resorting to WebWorkers.

@ssartell
Copy link
Contributor Author

ssartell commented Dec 3, 2017

While I agree with your point, I mimicked the other existing methods. Any flaw this method has already exists in the library. And as you said, none of the generators in the library are infinite so it should not be a problem in practice.

@dankogai dankogai merged commit a0c2104 into dankogai:master Dec 3, 2017
@dankogai
Copy link
Owner

dankogai commented Dec 3, 2017

Thank you. Travis is happy again with io.js dropped. I added the doc to README.md and incremented the version to 0.5.3.

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

Successfully merging this pull request may close these issues.

3 participants