-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
[wip] return a promise when there is no callback in concat #41
base: master
Are you sure you want to change the base?
Conversation
Thanks for the PR! I was planning to look into Promise support for the next major version. A couple thoughts:
Thoughts? |
I think supporting both is the way to go for any existing library. Switching from one to the other implies that all of your users will have to migrate from one to the other, or be stuck on a minor updates.
I typically don't duplicate the tests. I go additive and just test the promise layer on top. I know it's more messy but it gets the job done and it does not break anybody. I'm also +1 to add some async-await specific tests, just to validate how the user will see the API (see https://github.com/fastify/fastify/blob/master/test/async-await.test.js and https://github.com/fastify/fastify/blob/master/test/async-await.js). Another option is to switch to |
+1 for this, as well as keeping both interfaces. Use |
+1 for this merge! :D |
@feross would you like me to update this to use |
@mcollina I want to think about this a bit more before deciding what to do. |
Any updates on this? |
Still nothing since 2 years?! |
I've added support for async/await during
get.concat()
.This is a wip, and more intended to discuss rather than a proper direction.
The main concern is on the return type, which is in the form of
{ res, data }
, so it uses a full object instead of positional arguments. This is also the main reason whyutil.promisify()
cannot be used withget.concat()
.It also make the module pass the > 100 lines :(.
(we can also ship
require('simple-get/promise')
as a second entry point).