Вход Регистрация
Файл: error-kitty/node_modules/mocha/node_modules/debug/browser.js
Строк: 119
<?php
/**
 * This is the web browser implementation of `debug()`.
 *
 * Expose `debug()` as the module.
 */

exports module.exports = require('./debug');
exports.log log;
exports.formatArgs formatArgs;
exports.save save;
exports.load load;
exports.useColors useColors;

/**
 * Colors.
 */

exports.colors = [
  
'lightseagreen',
  
'forestgreen',
  
'goldenrod',
  
'dodgerblue',
  
'darkorchid',
  
'crimson'
];

/**
 * Currently only WebKit-based Web Inspectors, Firefox >= v31,
 * and the Firebug extension (any Firefox version) are known
 * to support "%c" CSS customizations.
 *
 * TODO: add a `localStorage` variable to explicitly enable/disable colors
 */

function useColors() {
  
// is webkit? http://stackoverflow.com/a/16459606/376773
  
return ('WebkitAppearance' in document.documentElement.style) ||
    
// is firebug? http://stackoverflow.com/a/398120/376773
    
(window.console && (console.firebug || (console.exception && console.table))) ||
    
// is firefox >= v31?
    // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
    
(navigator.userAgent.toLowerCase().match(/firefox/(d+)/) && parseInt(RegExp.$110) >= 31);
}

/**
 * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
 */

exports.formatters.= function(v) {
  return 
JSON.stringify(v);
};


/**
 * Colorize log arguments if enabled.
 *
 * @api public
 */

function formatArgs() {
  var 
args arguments;
  var 
useColors this.useColors;

  
args[0] = (useColors '%c' '')
    + 
this.namespace
    + (
useColors ' %c' ' ')
    + 
args[0]
    + (
useColors '%c ' ' ')
    + 
'+' exports.humanize(this.diff);

  if (!
useColors) return args;

  var 
'color: ' this.color;
  
args = [args[0], c'color: inherit'].concat(Array.prototype.slice.call(args1));

  
// the final "%c" is somewhat tricky, because there could be other
  // arguments passed either before or after the %c, so we need to
  // figure out the correct index to insert the CSS into
  
var index 0;
  var 
lastC 0;
  
args[0].replace(/%[a-z%]/g, function(match) {
    if (
'%%' === match) return;
    
index++;
    if (
'%c' === match) {
      
// we only are interested in the *last* %c
      // (the user may have provided their own)
      
lastC index;
    }
  });

  
args.splice(lastC0c);
  return 
args;
}

/**
 * Invokes `console.log()` when available.
 * No-op when `console.log` is not a "function".
 *
 * @api public
 */

function log() {
  
// This hackery is required for IE8,
  // where the `console.log` function doesn't have 'apply'
  
return 'object' == typeof console
    
&& 'function' == typeof console.log
    
&& Function.prototype.apply.call(console.logconsolearguments);
}

/**
 * Save `namespaces`.
 *
 * @param {String} namespaces
 * @api private
 */

function save(namespaces) {
  try {
    if (
null == namespaces) {
      
localStorage.removeItem('debug');
    } else {
      
localStorage.debug namespaces;
    }
  } catch(
e) {}
}

/**
 * Load `namespaces`.
 *
 * @return {String} returns the previously persisted debug modes
 * @api private
 */

function load() {
  var 
r;
  try {
    
localStorage.debug;
  } catch(
e) {}
  return 
r;
}

/**
 * Enable namespaces listed in `localStorage.debug` initially.
 */

exports.enable(load());
?>
Онлайн: 1
Реклама