diff --git a/dist/debug.js b/dist/debug.js index 97d6f787..4808b249 100644 --- a/dist/debug.js +++ b/dist/debug.js @@ -7,7 +7,7 @@ * Expose `debug()` as the module. */ -exports = module.exports = debug; +exports = module.exports = debug.debug = debug; exports.coerce = coerce; exports.disable = disable; exports.enable = enable; @@ -238,6 +238,8 @@ module.exports = function(val, options){ */ function parse(str) { + str = '' + str; + if (str.length > 10000) return; var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str); if (!match) return; var n = parseFloat(match[1]); @@ -336,17 +338,10 @@ exports.formatArgs = formatArgs; exports.save = save; exports.load = load; exports.useColors = useColors; - -/** - * Use chrome.storage.local if we are in an app - */ - -var storage; - -if (typeof chrome !== 'undefined' && typeof chrome.storage !== 'undefined') - storage = chrome.storage.local; -else - storage = localstorage(); +exports.storage = 'undefined' != typeof chrome + && 'undefined' != typeof chrome.storage + ? chrome.storage.local + : localstorage(); /** * Colors. @@ -454,9 +449,9 @@ function log() { function save(namespaces) { try { if (null == namespaces) { - storage.removeItem('debug'); + exports.storage.removeItem('debug'); } else { - storage.debug = namespaces; + exports.storage.debug = namespaces; } } catch(e) {} } @@ -471,7 +466,7 @@ function save(namespaces) { function load() { var r; try { - r = storage.debug; + r = exports.storage.debug; } catch(e) {} return r; }