(...args)
| 64 | let enabledCache; |
| 65 | |
| 66 | function debug(...args) { |
| 67 | // Disabled? |
| 68 | if (!debug.enabled) { |
| 69 | return; |
| 70 | } |
| 71 | |
| 72 | const self = debug; |
| 73 | |
| 74 | // Set `diff` timestamp |
| 75 | const curr = Number(new Date()); |
| 76 | const ms = curr - (prevTime || curr); |
| 77 | self.diff = ms; |
| 78 | self.prev = prevTime; |
| 79 | self.curr = curr; |
| 80 | prevTime = curr; |
| 81 | |
| 82 | args[0] = createDebug.coerce(args[0]); |
| 83 | |
| 84 | if (typeof args[0] !== 'string') { |
| 85 | // Anything else let's inspect with %O |
| 86 | args.unshift('%O'); |
| 87 | } |
| 88 | |
| 89 | // Apply any `formatters` transformations |
| 90 | let index = 0; |
| 91 | args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { |
| 92 | // If we encounter an escaped % then don't increase the array index |
| 93 | if (match === '%%') { |
| 94 | return '%'; |
| 95 | } |
| 96 | index++; |
| 97 | const formatter = createDebug.formatters[format]; |
| 98 | if (typeof formatter === 'function') { |
| 99 | const val = args[index]; |
| 100 | match = formatter.call(self, val); |
| 101 | |
| 102 | // Now we need to remove `args[index]` since it's inlined in the `format` |
| 103 | args.splice(index, 1); |
| 104 | index--; |
| 105 | } |
| 106 | return match; |
| 107 | }); |
| 108 | |
| 109 | // Apply env-specific formatting (colors, etc.) |
| 110 | createDebug.formatArgs.call(self, args); |
| 111 | |
| 112 | const logFn = self.log || createDebug.log; |
| 113 | logFn.apply(self, args); |
| 114 | } |
| 115 | |
| 116 | debug.namespace = namespace; |
| 117 | debug.useColors = createDebug.useColors(); |
no outgoing calls
no test coverage detected
searching dependent graphs…