Вход Регистрация
Файл: error-kitty/node_modules/mocha/node_modules/debug/node.js
Строк: 90
<?php
/**
 * Module dependencies.
 */

var tty = require('tty');
var 
util = require('util');

/**
 * This is the Node.js 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 = [623451];

/**
 * Is stdout a TTY? Colored output is enabled when `true`.
 */

function useColors() {
  var 
debugColors = (process.env.DEBUG_COLORS || '').trim().toLowerCase();
  if (
=== debugColors.length) {
    return 
tty.isatty(1);
  } else {
    return 
'0' !== debugColors
        
&& 'no' !== debugColors
        
&& 'false' !== debugColors
        
&& 'disabled' !== debugColors;
  }
}

/**
 * Map %o to `util.inspect()`, since Node doesn't do that out of the box.
 */

var inspect = (=== util.inspect.length ?
  
// node <= 0.8.x
  
function (vcolors) {
    return 
util.inspect(vvoid 0void 0colors);
  } :
  
// node > 0.8.x
  
function (vcolors) {
    return 
util.inspect(v, { colorscolors });
  }
);

exports.formatters.= function(v) {
  return 
inspect(vthis.useColors)
    .
replace(/s*ns*/g' ');
};

/**
 * Adds ANSI color escape codes if enabled.
 *
 * @api public
 */

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

  if (
useColors) {
    var 
this.color;

    
args[0] = '  u001b[9' 'm' name ' '
      
'u001b[0m'
      
args[0] + 'u001b[3' 'm'
      
' +' exports.humanize(this.diff) + 'u001b[0m';
  } else {
    
args[0] = new Date().toUTCString()
      + 
' ' name ' ' args[0];
  }
  return 
args;
}

/**
 * Invokes `console.error()` with the specified arguments.
 */

function log() {
  return 
console.error.apply(consolearguments);
}

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

function save(namespaces) {
  if (
null == namespaces) {
    
// If you set a process.env field to null or undefined, it gets cast to the
    // string 'null' or 'undefined'. Just delete instead.
    
delete process.env.DEBUG;
  } else {
    
process.env.DEBUG namespaces;
  }
}

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

function load() {
  return 
process.env.DEBUG;
}

/**
 * Enable namespaces listed in `process.env.DEBUG` initially.
 */

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