MCPcopy Create free account
hub / github.com/di-sukharev/opencommit / createDebug3

Function createDebug3

out/cli.cjs:14883–14948  ·  view source on GitHub ↗
(namespace)

Source from the content-addressed store, hash-verified

14881 }
14882 createDebug3.selectColor = selectColor;
14883 function createDebug3(namespace) {
14884 let prevTime;
14885 let enableOverride = null;
14886 let namespacesCache;
14887 let enabledCache;
14888 function debug5(...args) {
14889 if (!debug5.enabled) {
14890 return;
14891 }
14892 const self2 = debug5;
14893 const curr = Number(/* @__PURE__ */ new Date());
14894 const ms = curr - (prevTime || curr);
14895 self2.diff = ms;
14896 self2.prev = prevTime;
14897 self2.curr = curr;
14898 prevTime = curr;
14899 args[0] = createDebug3.coerce(args[0]);
14900 if (typeof args[0] !== "string") {
14901 args.unshift("%O");
14902 }
14903 let index = 0;
14904 args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
14905 if (match === "%%") {
14906 return "%";
14907 }
14908 index++;
14909 const formatter = createDebug3.formatters[format];
14910 if (typeof formatter === "function") {
14911 const val = args[index];
14912 match = formatter.call(self2, val);
14913 args.splice(index, 1);
14914 index--;
14915 }
14916 return match;
14917 });
14918 createDebug3.formatArgs.call(self2, args);
14919 const logFn = self2.log || createDebug3.log;
14920 logFn.apply(self2, args);
14921 }
14922 debug5.namespace = namespace;
14923 debug5.useColors = createDebug3.useColors();
14924 debug5.color = createDebug3.selectColor(namespace);
14925 debug5.extend = extend3;
14926 debug5.destroy = createDebug3.destroy;
14927 Object.defineProperty(debug5, "enabled", {
14928 enumerable: true,
14929 configurable: false,
14930 get: () => {
14931 if (enableOverride !== null) {
14932 return enableOverride;
14933 }
14934 if (namespacesCache !== createDebug3.namespaces) {
14935 namespacesCache = createDebug3.namespaces;
14936 enabledCache = createDebug3.enabled(namespace);
14937 }
14938 return enabledCache;
14939 },
14940 set: (v5) => {

Callers 1

extend3Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected