/usr/lib/nodejs/debug-fabulous/src/lazy-eval.js is in node-debug-fabulous 0.0.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | var slice = [].slice,
objectAssign = require('object-assign');
function _resolveOutput(func, bindThis) {
var wrapped = function() {
var args;
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
// lazy function eval to keep output memory pressure down, if not used
if (typeof args[0] === 'function') {
args[0] = args[0]();
}
return func.apply(bindThis, args);
};
objectAssign(wrapped, func);
return wrapped;
};
function wrapEval(debug) {
var debugOrig = debug,
noop = function(){};
debug = function (namespace) {
var instance = debugOrig(namespace);
// if we're not enabled then don't attempt to log anything
// if a debug namespace wraps its debug in a closure then it never allocates anything but the function itself
if (!instance.enabled){
objectAssign(noop, instance);
instance = noop;
}
else {
instance = _resolveOutput(instance);
}
return instance;
}
objectAssign(debug, debugOrig);
return debug;
}
module.exports = wrapEval;
|