"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.when = when;
exports.promiseNormalize = promiseNormalize;
// wait for a promise or plain object to resolve
function when(value, callback, reject) {
    if (value?.then) {
        return value.then(callback, reject);
    }
    return callback(value);
}
function promiseNormalize(returnValue, target) {
    if (!returnValue?.then && !target?.syncAllowed) {
        return Promise.resolve(returnValue);
    }
    return returnValue;
}
//# sourceMappingURL=when.js.map