MCPcopy
hub / github.com/Kong/insomnia / debug

Function debug

packages/insomnia/bin/yarn-standalone.js:38955–39005  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38953 var prevTime;
38954
38955 function debug() {
38956 // disabled?
38957 if (!debug.enabled) return;
38958
38959 var self = debug;
38960
38961 // set `diff` timestamp
38962 var curr = +new Date();
38963 var ms = curr - (prevTime || curr);
38964 self.diff = ms;
38965 self.prev = prevTime;
38966 self.curr = curr;
38967 prevTime = curr;
38968
38969 // turn the `arguments` into a proper Array
38970 var args = new Array(arguments.length);
38971 for (var i = 0; i < args.length; i++) {
38972 args[i] = arguments[i];
38973 }
38974
38975 args[0] = exports.coerce(args[0]);
38976
38977 if ('string' !== typeof args[0]) {
38978 // anything else let's inspect with %O
38979 args.unshift('%O');
38980 }
38981
38982 // apply any `formatters` transformations
38983 var index = 0;
38984 args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
38985 // if we encounter an escaped % then don't increase the array index
38986 if (match === '%%') return match;
38987 index++;
38988 var formatter = exports.formatters[format];
38989 if ('function' === typeof formatter) {
38990 var val = args[index];
38991 match = formatter.call(self, val);
38992
38993 // now we need to remove `args[index]` since it's inlined in the `format`
38994 args.splice(index, 1);
38995 index--;
38996 }
38997 return match;
38998 });
38999
39000 // apply env-specific formatting (colors, etc.)
39001 exports.formatArgs.call(self, args);
39002
39003 var logFn = debug.log || exports.log || console.log.bind(console);
39004 logFn.apply(self, args);
39005 }
39006
39007 debug.namespace = namespace;
39008 debug.enabled = exports.enabled(namespace);

Callers 15

yarn-standalone.jsFile · 0.70
SemVerFunction · 0.70
ComparatorFunction · 0.70
parseComparatorFunction · 0.70
replaceTildeFunction · 0.70
replaceCaretFunction · 0.70
replaceXRangesFunction · 0.70
replaceXRangeFunction · 0.70
replaceStarsFunction · 0.70
testSetFunction · 0.70
stuckTickMethod · 0.70
shiftMethod · 0.70

Calls 1

errorMethod · 0.45

Tested by

no test coverage detected