source:
node_modules/es-toolkit/dist/compat/function/attempt.mjs@
ba17441
| Last change on this file since ba17441 was a762898, checked in by , 6 months ago | |
|---|---|
|
|
| File size: 179 bytes | |
| Rev | Line | |
|---|---|---|
| [a762898] | 1 | function attempt(func, ...args) { |
| 2 | try { | |
| 3 | return func(...args); | |
| 4 | } | |
| 5 | catch (e) { | |
| 6 | return e instanceof Error ? e : new Error(e); | |
| 7 | } | |
| 8 | } | |
| 9 | ||
| 10 | export { attempt }; |
Note:
See TracBrowser
for help on using the repository browser.
