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

skip a task from including in result #60

Closed
Thore1954 opened this issue Sep 19, 2022 · 2 comments
Closed

skip a task from including in result #60

Thore1954 opened this issue Sep 19, 2022 · 2 comments

Comments

@Thore1954
Copy link

Thore1954 commented Sep 19, 2022

Basically I want to do filtering on my original list based on the result of async operations. I tried returning undefined from the process callback but it just fills the resulting array with undefineds. Is there a way to skip including a value in the resulting array like pMapSkip from sindresorhus/p-map#39?

@tylercollier
Copy link
Contributor

tylercollier commented Sep 20, 2022

Is filtering the end result of undefined's not a valid solution? Or how about returning a known Symbol. The symbol could be e.g. Symbol('skipped'), and then you could filter those out of the result.

@marcuspoehls can correct me if I'm wrong but I think you could just throw an error in your handler to skip it. It would of course show in the returned errors value.

@Thore1954
Copy link
Author

Of course you eventually need to filter the end result or the errors. I just thought it was already built in. Closing this.

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