@ima/plugin-testing-integration
Version:
IMA.js plugin for integration testing
49 lines (48 loc) • 1.21 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: Object.getOwnPropertyDescriptor(all, name).get
});
}
_export(exports, {
get aop () {
return aop;
},
get createHook () {
return _toaop.createHook;
},
get hookName () {
return _toaop.hookName;
},
get unAopAll () {
return unAopAll;
}
});
const _toaop = require("to-aop");
let aopTargetsContainer = [];
/**
* Extends default aop (from to-aop) behavior by saving the targets,
* which can be cleared later with unAopAll function.
*
* @param {object | Function} target
* @param {...any} args
* @returns {*} native aop value
*/ function aop(target, ...args) {
if (!aopTargetsContainer.includes(target)) {
aopTargetsContainer.push(target);
}
return (0, _toaop.aop)(target, ...args);
}
/**
* Clears aop hooks from all targets.
*/ function unAopAll() {
for (const target of aopTargetsContainer){
(0, _toaop.unAop)(target);
}
aopTargetsContainer = [];
}
//# sourceMappingURL=aop.js.map