source:
node_modules/es-toolkit/dist/util/attempt.mjs
| Last change on this file was a762898, checked in by , 5 months ago | |
|---|---|
|
|
| File size: 151 bytes | |
| Line | |
|---|---|
| 1 | function attempt(func) { |
| 2 | try { |
| 3 | return [null, func()]; |
| 4 | } |
| 5 | catch (error) { |
| 6 | return [error, null]; |
| 7 | } |
| 8 | } |
| 9 | |
| 10 | export { attempt }; |
Note:
See TracBrowser
for help on using the repository browser.
