UNPKG
fliphub-monorepo
Version:
latest (0.1.3)
0.1.3
0.1.2
the builder of builders
github.com/fliphub/fliphub
fliphub/fliphub
fliphub-monorepo
/
packages
/
fliphub-helpers
/
src
/
trycatch.js
13 lines
(11 loc)
•
186 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
module
.
exports
= function
tryCatch
({cb,
when
, catchCb})
{
if
(
when
) {
try
{
const
result
=
cb()
return
cb }
catch
(e) { catchCb(e) } }
return
cb() }