Comparing version 4.2.0 to 4.3.0
{ | ||
"name": "debug", | ||
"version": "4.2.0", | ||
"version": "4.3.0", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
@@ -12,3 +12,13 @@ /* eslint-env browser */ | ||
exports.storage = localstorage(); | ||
exports.destroy = (() => { | ||
let warned = false; | ||
return () => { | ||
if (!warned) { | ||
warned = true; | ||
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); | ||
} | ||
}; | ||
})(); | ||
/** | ||
@@ -15,0 +25,0 @@ * Colors. |
@@ -15,2 +15,3 @@ | ||
createDebug.humanize = require('ms'); | ||
createDebug.destroy = destroy; | ||
@@ -22,7 +23,2 @@ Object.keys(env).forEach(key => { | ||
/** | ||
* Active `debug` instances. | ||
*/ | ||
createDebug.instances = []; | ||
/** | ||
* The currently active debug mode names, and names to skip. | ||
@@ -68,2 +64,3 @@ */ | ||
let prevTime; | ||
let enableOverride = null; | ||
@@ -98,3 +95,3 @@ function debug(...args) { | ||
if (match === '%%') { | ||
return match; | ||
return '%'; | ||
} | ||
@@ -122,8 +119,16 @@ index++; | ||
debug.namespace = namespace; | ||
debug.enabled = createDebug.enabled(namespace); | ||
debug.useColors = createDebug.useColors(); | ||
debug.color = createDebug.selectColor(namespace); | ||
debug.destroy = destroy; | ||
debug.extend = extend; | ||
debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. | ||
Object.defineProperty(debug, 'enabled', { | ||
enumerable: true, | ||
configurable: false, | ||
get: () => enableOverride === null ? createDebug.enabled(namespace) : enableOverride, | ||
set: v => { | ||
enableOverride = v; | ||
} | ||
}); | ||
// Env-specific initialization logic for debug instances | ||
@@ -134,16 +139,5 @@ if (typeof createDebug.init === 'function') { | ||
createDebug.instances.push(debug); | ||
return debug; | ||
} | ||
function destroy() { | ||
const index = createDebug.instances.indexOf(this); | ||
if (index !== -1) { | ||
createDebug.instances.splice(index, 1); | ||
return true; | ||
} | ||
return false; | ||
} | ||
function extend(namespace, delimiter) { | ||
@@ -186,7 +180,2 @@ const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); | ||
} | ||
for (i = 0; i < createDebug.instances.length; i++) { | ||
const instance = createDebug.instances[i]; | ||
instance.enabled = createDebug.enabled(instance.namespace); | ||
} | ||
} | ||
@@ -266,2 +255,10 @@ | ||
/** | ||
* XXX DO NOT USE. This is a temporary stub function. | ||
* XXX It WILL be removed in the next major release. | ||
*/ | ||
function destroy() { | ||
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); | ||
} | ||
createDebug.enable(createDebug.load()); | ||
@@ -268,0 +265,0 @@ |
@@ -18,2 +18,6 @@ /** | ||
exports.useColors = useColors; | ||
exports.destroy = util.deprecate( | ||
() => {}, | ||
'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' | ||
); | ||
@@ -20,0 +24,0 @@ /** |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41047
700
2