Tryor
tryor
try or return default.
tryor
will give you back the return value of the function or, in case the function threw an exception, the default value.
tryor
just wrap the fn
and default
in try-catch as below:
1 2 3 4 5 6 7 8 9 |
|
Get it: npm install tryor
Sample usage:
1 2 3 4 5 6 7 |
|
1 2 |
|
GIF FTW!