UNPKG

es-toolkit

Version:

A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.

11 lines (9 loc) 179 B
function attempt(func, ...args) { try { return func(...args); } catch (e) { return e instanceof Error ? e : new Error(e); } } export { attempt };