MCPcopy Create free account
hub / github.com/WebReflection/neverland / augmentor

Function augmentor

index.js:294–318  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

292 var state = null; // main exports
293
294 var augmentor = function augmentor(fn) {
295 var stack = [];
296 return function hook() {
297 var prev = state;
298 var after = [];
299 state = {
300 hook: hook,
301 args: arguments,
302 stack: stack,
303 i: 0,
304 length: stack.length,
305 after: after
306 };
307
308 try {
309 return fn.apply(null, arguments);
310 } finally {
311 state = prev;
312
313 for (var i = 0, length = after.length; i < length; i++) {
314 after[i]();
315 }
316 }
317 };
318 };
319 var contextual = function contextual(fn) {
320 var check = true;
321 var context = null;

Callers 4

contextualFunction · 0.70
augmentor$1Function · 0.70
createHookFunction · 0.50
createHookFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected