power-di
Version:
A lightweight Dependency Injection library. Using es6 and other features, remove unnecessary concepts, easy and convenient to use.
16 lines • 414 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.guard = void 0;
function guard(f, opt) {
var _a;
if (opt === void 0) { opt = {}; }
try {
return f();
}
catch (error) {
(_a = opt.onError) === null || _a === void 0 ? void 0 : _a.call(opt, error);
return opt.defaultValue;
}
}
exports.guard = guard;
//# sourceMappingURL=guard.js.map