I have a function call like so:
await someFunction(foo);
With someFunction
defined like:
const someFunction = foo => {
return new Promise((resolve, reject) => {
if (foo) {
return resolve(someOtherPromise());
}
reject();
}
}
Is this valid code? I have tested it and it seems ok.
Is it correct that await someFunction()
will transform to await someOtherPromise()
if foo
is true
i.e. will it continue waiting for someOtherPromise
to resolve?