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 p-one module #6

Merged
merged 1 commit into from
Jun 2, 2017
Merged

Add p-one module #6

merged 1 commit into from
Jun 2, 2017

Conversation

kevva
Copy link
Contributor

@kevva kevva commented May 24, 2017

No description provided.

@sindresorhus
Copy link
Owner

This is a good idea. I've sometimes wanted to be able to do a test in p-any to make sure the value is valid before returning. You're not really taking advantage of concurrency here, which is the point of these modules existing, otherwise you could simply use Promise.all(), like I commented in the other issue. This one has potential though, as you could return the moment the first resolved promise passes a test. I do wonder if it would make more sense to instead add a validation/testing argument to p-some and p-any instead. Thoughts?

@kevva
Copy link
Contributor Author

kevva commented May 24, 2017

This one has potential though, as you could return the moment the first resolved promise passes a test.

Fixed now.

I do wonder if it would make more sense to instead add a validation/testing argument to p-some and p-any instead. Thoughts?

That might be a good idea. How would that work though? Would it return false if the test fails and the resolved value if it succeeds?

@sindresorhus
Copy link
Owner

That might be a good idea. How would that work though? Would it return false if the test fails and the resolved value if it succeeds?

This is what I was thinking: sindresorhus/p-some#1

@sindresorhus sindresorhus changed the title Add p-one Add p-one module Jun 2, 2017
@sindresorhus sindresorhus merged commit 3688dcb into master Jun 2, 2017
@sindresorhus sindresorhus deleted the p-one branch June 2, 2017 18:40
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.

2 participants