This commit is contained in:
hatuhn
2019-09-13 09:45:04 +07:00
parent f14a34ba19
commit 558fb07261
16790 changed files with 0 additions and 1642370 deletions

View File

@@ -1,18 +0,0 @@
module.exports = function debugFactory(_debugApi, _options) {
var wrapLazyEval = require('./lazy-eval');
var formatArgs = require('./formatArgs');
var options = _options || {
formatArgs: true
};
var debugApi = _debugApi ? _debugApi : require('debug');
debugApi = wrapLazyEval(debugApi);
debugApi = formatArgs({
debugApi: debugApi,
options: options
});
return debugApi;
}

View File

@@ -1,24 +0,0 @@
module.exports = function formatArgs(args) {
var debugApi = args.debugApi;
var options = args.options;
if(options.formatArgs == true){
/*
fixing it so we don't get redundant timestamps on prod
https://github.com/visionmedia/debug/issues/161
*/
debugApi.formatArgs = function() {
if (this.useColors)
arguments[0] = ' \u001b[9' + this.color + 'm' + this.namespace + ' ' + '\u001b[0m' + arguments[0];
else
arguments[0] = ' ' + this.namespace + ' ' + arguments[0];
return arguments;
}
}
else if ( typeof options.formatArgs === 'function'){
debugApi.formatArgs = options.formatArgs;
}
return debugApi;
}

View File

@@ -1,46 +0,0 @@
var objectAssign = require('object-assign');
var memoize = require('memoizee');
function _resolveOutput(func, bindThis) {
var wrapped = function() {
var i = arguments.length;
var args = [];
while (i--) args[i] = arguments[i];
// 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;
function debug(namespace) {
function noop() {}
var instance = debugOrig(namespace);
/*
If we're not enabled then don't attempt to log anything.
Therefore when a debug namespace wraps its debug in a
closure then it never allocates anything but the function itself
*/
if (!instance.enabled) {
objectAssign(noop, instance);
return noop;
}
return _resolveOutput(instance);
}
var debugMemoized = memoize(debug);
objectAssign(debugMemoized, debugOrig);
return debugMemoized;
}
module.exports = wrapEval;

View File

@@ -1,32 +0,0 @@
function spawnFactory(_namespace, _debugFabFactory) {
var namespace = _namespace || '';
var debugFabFactory = _debugFabFactory;
if(!debugFabFactory){
debugFabFactory = require('./debugFabFactory')();
}
function spawn(ns) {
// this is this.debug (from Debugger)
var dbg = new Debugger(this.namespace, ns);
return dbg.debug;
};
function Debugger(_base, _ns){
var base = _base || '';
var ns = _ns || '';
var newNs = ns ? [base, ns].join(':') : base;
var debug = debugFabFactory(newNs);
this.debug = debug;
this.debug.spawn = spawn;
}
var rootDebug = (new Debugger(namespace)).debug;
return rootDebug;
};
module.exports = spawnFactory;