UNPKG

return-style

Version:

Non-intrusively convert the result of any function or promise to the user's desired style.

11 lines 248 B
import { Result } from "../classes/result.js"; export function toResult(fn) { try { const result = fn(); return Result.Ok(result); } catch (e) { return Result.Err(e); } } //# sourceMappingURL=to-result.js.map