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

isFulfilledP, isRejectedP, isPendingP #904

Open
char0n opened this issue May 3, 2019 · 2 comments
Open

isFulfilledP, isRejectedP, isPendingP #904

char0n opened this issue May 3, 2019 · 2 comments

Comments

@char0n
Copy link
Owner

char0n commented May 3, 2019

Is your feature request related to a problem? Please describe.

These 3 predicates could inspect the state of the promise or the objects returned by RA.allSettledP. These functions must be synchronous.

Describe the solution you'd like

RA.isFullfilledP(Promise.resolve(3)); // => true
RA.isRejectedP(Promise.reject(3)); // => true
RA.isPendingP(RA.delayP(200)); //=> true

Describe alternatives you've considered

--

Additional context

https://ourcodeworld.com/articles/read/317/how-to-check-if-a-javascript-promise-has-been-fulfilled-rejected-or-resolved

Chais-as-promised contains implementation for two of these predicate functions: https://www.chaijs.com/plugins/chai-as-promised/

RA.isPendingP is true when RA.isFullfilledP and RA.isRejectedP both return false. We can use this fact to compose this predicates.

@char0n char0n added the Hacktoberfest Hacktoberfest 2020 label Sep 13, 2020
@tauantcamargo
Copy link
Contributor

@char0n could i take this one?

@char0n
Copy link
Owner Author

char0n commented Sep 18, 2022

@tauantcamargo feel free to grad any function you like. All the function described in issues are on the plate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants