rc-js-util
Version:
A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.
17 lines • 468 B
JavaScript
import { __awaiter } from "tslib";
/**
* @public
* Returns a Promise of rejection with the supplied error if the `value` is falsy.
*
* @remarks
* See {@link promiseRejectFalsey}.
*/
export function promiseRejectFalsey(value, error) {
return __awaiter(this, void 0, void 0, function* () {
const result = yield value;
if (!result) {
return Promise.reject(error);
}
});
}
//# sourceMappingURL=promise-reject-falsey.js.map