lib/report.js
function stringifyCommand(state, command)
{
  var name;

  if (typeof command == 'function')
  {
    name = typeof command.commandDescription == 'function'
      ? command.commandDescription(state)
      : Function.prototype.toString.call(command)
      ;

    // truncate long functions
    name = name.split('\n');

    // remove inline comments
    name = name.filter((line) => !line.match(/^\s*\/\//));
    name = name
      .map((line) => line.replace(/^([^'"]*)\s*\/\/.*$/, '$1')) // remove end of line comments
      .map((line) => line.trim()) // remove extra space
      ;

    if (name.length > 6)
    {
      // get side lines
      name.splice(3, name.length - 5);

      // join first and last lines
      name = [name.slice(0, name.length - 2).join(' '), name.slice(-2).join(' ')].join(' ... ');
    }
    else
    {
      name = name.join(' ');
    }
  }
  else if (Array.isArray(command))
  {
    name = '[' + command.join(', ') + ']';
  }
  else if (typeOf(command) == 'object')
  {
    name = JSON.stringify(command);
  }
  else
  {
    name = '' + command;
  }

  return name;
}
function stringifyCommand(state, command)
{
  var name;

  if (typeof command == 'function')
  {
    name = typeof command.commandDescription == 'function'
      ? command.commandDescription(state)
      : Function.prototype.toString.call(command)
      ;

    // truncate long functions
    name = name.split('\n');

    // remove inline comments
    name = name.filter((line) => !line.match(/^\s*\/\//));
    name = name
      .map((line) => line.replace(/^([^'"]*)\s*\/\/.*$/, '$1')) // remove end of line comments
      .map((line) => line.trim()) // remove extra space
      ;

    if (name.length > 6)
    {
      // get side lines
      name.splice(3, name.length - 5);

      // join first and last lines
      name = [name.slice(0, name.length - 2).join(' '), name.slice(-2).join(' ')].join(' ... ');
    }
    else
    {
      name = name.join(' ');
    }
  }
  else if (Array.isArray(command))
  {
    name = '[' + command.join(', ') + ']';
  }
  else if (typeOf(command) == 'object')
  {
    name = JSON.stringify(command);
  }
  else
  {
    name = '' + command;
  }

  return name;
}
function stringifyCommand ( state , command ) { var name ; if ( typeof command == 'function' ) { name = typeof command . commandDescription == 'function' ? command . commandDescription ( state ) : Function . prototype . toString . call ( command ) ; // truncate long functions name = name . split ( '\n' ) ; // remove inline comments name = name . filter ( ( line ) => ! line . match ( / ^\s*\/\/ / ) ) ; name = name . map ( ( line ) => line . replace ( / ^([^'"]*)\s*\/\/.*$ / , '$1' ) ) // remove end of line comments . map ( ( line ) => line . trim ( ) ) // remove extra space ; if ( name . length > 6 ) { // get side lines name . splice ( 3 , name . length - 5 ) ; // join first and last lines name = [ name . slice ( 0 , name . length - 2 ) . join ( ' ' ) , name . slice ( - 2 ) . join ( ' ' ) ] . join ( ' ... ' ) ; } else { name = name . join ( ' ' ) ; } } else if ( Array . isArray ( command ) ) { name = '[' + command . join ( ', ' ) + ']' ; } else if ( typeOf ( command ) == 'object' ) { name = JSON . stringify ( command ) ; } else { name = '' + command ; } return name ; }
Gets command description out of command object

@private
@param   {object} state - current state
@param   {mixed} command - command object
@returns {string} - description of the command
Gets command description out of command object