Comparing version 0.0.6 to 0.0.7
{ | ||
"name": "webdetta", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"author": "Fedot Kriutchenko <fodyadev@gmail.com>", | ||
@@ -5,0 +5,0 @@ "description": "", |
const AsyncFunction = (async () => {}).constructor; | ||
export const isAsync = f => f instanceof AsyncFunction; | ||
export const safe = f => (...args) => { | ||
export const safe = func => function() { | ||
try { | ||
return isAsync(f) | ||
? Promise.resolve().then(() => f(...args)).catch(e => console.error(e)) | ||
: f(...args); | ||
return isAsync(func) | ||
? Promise.resolve() | ||
.then(() => f.apply(this, arguments)) | ||
.catch(e => console.error(e)) | ||
: f.apply(this, arguments); | ||
} | ||
catch (e) { console.error(e); } | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24141
693