js/smartweave.js
/**
   * Colorize log arguments if enabled.
   *
   * @api public
   */
Colorize log arguments if enabled.
@api public
Colorize log arguments if enabled . @api public
function formatArgs(args) {
  	args[0] = (this.useColors ? '%c' : '') +
  		this.namespace +
  		(this.useColors ? ' %c' : ' ') +
  		args[0] +
  		(this.useColors ? '%c ' : ' ') +
  		'+' + module.exports.humanize(this.diff);
  	if (!this.useColors) {
  		return;
  	}
  	const c = 'color: ' + this.color;
  	args.splice(1, 0, c, 'color: inherit');
  	let index = 0;
  	let lastC = 0;
  	args[0].replace(/%[a-zA-Z%]/g, match => {
  		if (match === '%%') {
  			return;
  		}
  		index++;
  		if (match === '%c') {
  			lastC = index;
  		}
  	});
  	args.splice(lastC, 0, c);
  }
function formatArgs ( args ) { args [ 0 ] = ( this . useColors ? '%c' : '' ) + this . namespace + ( this . useColors ? ' %c' : ' ' ) + args [ 0 ] + ( this . useColors ? '%c ' : ' ' ) + '+' + module . exports . humanize ( this . diff ) ; if ( ! this . useColors ) { return ; } const c = 'color: ' + this . color ; args . splice ( 1 , 0 , c , 'color: inherit' ) ; let index = 0 ; let lastC = 0 ; args [ 0 ] . replace ( / %[a-zA-Z%] / g , match => { if ( match === '%%' ) { return ; } index ++ ; if ( match === '%c' ) { lastC = index ; } } ) ; args . splice ( lastC , 0 , c ) ; }
Colorize log arguments if enabled.
Colorize log arguments if enabled .
// 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 // We only are interested in the *last* %c // (the user may have provided their own)