diff --git a/src/debug.js b/src/debug.js index edbd22f7..6edb3d52 100644 --- a/src/debug.js +++ b/src/debug.js @@ -119,6 +119,7 @@ function createDebug(namespace) { debug.enabled = exports.enabled(namespace); debug.useColors = exports.useColors(); debug.color = selectColor(namespace); + debug.destroy = destroy; // env-specific initialization logic for debug instances if ('function' === typeof exports.init) { @@ -130,6 +131,11 @@ function createDebug(namespace) { return debug; } +function destroy () { + const index = exports.instances.indexOf(this) + exports.instances.splice(index, 1) +} + /** * Enables a debug mode by namespaces. This can include modes * separated by a colon and wildcards.