Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const stubAll = (target) => {
- Object.getOwnPropertyNames(target).forEach((name) => {
- if (typeof target[name] === 'function') {
- const orig = target[name];
- console.log('sub', name);
- target[name] = (function (fnName) {
- target[name].orig = orig;
- return function (...args) {
- console.log('called', fnName);
- return target[name].orig.apply(target, args);
- };
- })();
- }
- });
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement