typed-utilities
Version:
Strongly typed general purpose utilities
19 lines (15 loc) • 330 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.useAsync = void 0;
const useAsync = async (create, destroy, use) => {
const r = await create();
try {
return await use(r);
} finally {
await destroy(r);
}
};
exports.useAsync = useAsync;
//# sourceMappingURL=useAsync.js.map