UNPKG

on-error-resume-next

Version:

Run a function, synchronously or asynchronously, and ignore errors.

21 lines (20 loc) 429 B
import { isPromise } from "./chunk-MBTBSBLB.mjs"; // src/index.ts function onErrorResumeNext(fn, context) { let result; try { result = fn.call(context); } catch { return void 0; } if (isPromise(result)) { throw new Error('Promise is not supported, please use "on-error-resume-next/async" instead.'); } return result; } export { onErrorResumeNext }; //# sourceMappingURL=on-error-resume-next.mjs.map