diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-05-24 15:10:37 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-05-24 15:11:17 +0200 |
commit | 7a3df06eb573d36142bd1a8e03c5ce8752d300b3 (patch) | |
tree | 70bfaea8884c374876f607774850a3a51c0cb381 /node_modules/debug/src | |
parent | aca1143cb9eed16cf37f04e475e4257418dd18ac (diff) |
fix build issues and add typedoc
Diffstat (limited to 'node_modules/debug/src')
-rw-r--r-- | node_modules/debug/src/browser.js | 19 | ||||
-rw-r--r-- | node_modules/debug/src/debug.js | 2 | ||||
-rw-r--r-- | node_modules/debug/src/node.js | 9 |
3 files changed, 19 insertions, 11 deletions
diff --git a/node_modules/debug/src/browser.js b/node_modules/debug/src/browser.js index 38d6391e3..7978ce722 100644 --- a/node_modules/debug/src/browser.js +++ b/node_modules/debug/src/browser.js @@ -40,20 +40,20 @@ function useColors() { // NB: In an Electron preload script, document will be defined but not fully // initialized. Since we know we're in Chrome, we'll just detect this case // explicitly - if (typeof window !== 'undefined' && window && typeof window.process !== 'undefined' && window.process.type === 'renderer') { + if (window && window.process && window.process.type === 'renderer') { return true; } // is webkit? http://stackoverflow.com/a/16459606/376773 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 - return (typeof document !== 'undefined' && document && 'WebkitAppearance' in document.documentElement.style) || + return (document && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || // is firebug? http://stackoverflow.com/a/398120/376773 - (typeof window !== 'undefined' && window && window.console && (console.firebug || (console.exception && console.table))) || + (window && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || // is firefox >= v31? // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages - (typeof navigator !== 'undefined' && navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + (navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || // double check webkit in userAgent just in case we are in a worker - (typeof navigator !== 'undefined' && navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); + (navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); } /** @@ -148,14 +148,17 @@ function save(namespaces) { */ function load() { + var r; try { - return exports.storage.debug; + r = exports.storage.debug; } catch(e) {} // If debug isn't set in LS, and we're in Electron, try to load $DEBUG - if (typeof process !== 'undefined' && 'env' in process) { - return process.env.DEBUG; + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; } + + return r; } /** diff --git a/node_modules/debug/src/debug.js b/node_modules/debug/src/debug.js index d5d6d1670..6a5e3fc94 100644 --- a/node_modules/debug/src/debug.js +++ b/node_modules/debug/src/debug.js @@ -141,7 +141,7 @@ function enable(namespaces) { exports.names = []; exports.skips = []; - var split = (namespaces || '').split(/[\s,]+/); + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); var len = split.length; for (var i = 0; i < len; i++) { diff --git a/node_modules/debug/src/node.js b/node_modules/debug/src/node.js index 4fa564b0d..af6129768 100644 --- a/node_modules/debug/src/node.js +++ b/node_modules/debug/src/node.js @@ -38,7 +38,7 @@ exports.inspectOpts = Object.keys(process.env).filter(function (key) { var prop = key .substring(6) .toLowerCase() - .replace(/_([a-z])/, function (_, k) { return k.toUpperCase() }); + .replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() }); // coerce string value into JS value var val = process.env[key]; @@ -231,7 +231,12 @@ function createWritableStdioStream (fd) { */ function init (debug) { - debug.inspectOpts = util._extend({}, exports.inspectOpts); + debug.inspectOpts = {}; + + var keys = Object.keys(exports.inspectOpts); + for (var i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } } /** |