proposal-iterator-helpers
proposal-iterator-helpers copied to clipboard
avoid using PromiseResolve with a value known not to be a Promise
A slight tweak to https://github.com/tc39/proposal-iterator-helpers/pull/215.
The reason to use PromiseResolve is to get the fast-path when the value being passed is expected to be a Promise. On this particular line we've just created the iterator result object with which we are resolving, so we know the value is not a Promise. This is equivalent but (I think) clearer.
If this isn't accepted, the ? in the Return ? PromiseResolve should at least be changed to !, since the throwy case is guarded on IsPromise of the argument.
I think I'd rather leave PromiseResolve and just use the !.