Ensure the return value of promiseTimeout always has .resolve and .reject (#550)

This commit is contained in:
toasted-nutbread 2020-05-24 13:39:50 -04:00 committed by GitHub
parent 3089bb7908
commit c800444a0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -164,7 +164,10 @@ function getSetDifference(set1, set2) {
function promiseTimeout(delay, resolveValue) { function promiseTimeout(delay, resolveValue) {
if (delay <= 0) { if (delay <= 0) {
return Promise.resolve(resolveValue); const promise = Promise.resolve(resolveValue);
promise.resolve = () => {}; // NOP
promise.reject = () => {}; // NOP
return promise;
} }
let timer = null; let timer = null;