Closed sindresorhus closed 4 years ago
Added a while ago.
Though I had at least. Added it now.
But I had to use a slightly different appraoch to not mess to much with tests or change sync behaviour. With your example the souce call is async, with the oldcode it was not.
So calls it sync like before but wraps it in a promise after the call, and catches sync errors.
Wraps the result anyway even if it is not a promise.
You might already have gotten the data before the prompt is created. Instead of forcing me to wrap my results in a promise, it would be nice if you just did:
Promise.resolve().then(() => opts.source)
.Note, I'm intentionally not suggesting
Promise.resolve(opts.source())
as that would not catch any synchronous error.Right now, I'm doing: