lib/base.js
function unifiedDiff(err, escape) {
  var indent = '      ';
  function cleanUp(line) {
    if (escape) {
      line = escapeInvisibles(line);
    }
    if (line[0] === '+') return indent + colorLines('diff added', line);
    if (line[0] === '-') return indent + colorLines('diff removed', line);
    if (line.match(/\@\@/)) return null;
    if (line.match(/\\ No newline/)) return null;
    else return indent + line;
  }
  function notBlank(line) {
    return line != null;
  }
  msg = diff.createPatch('string', err.actual, err.expected);
  var lines = msg.split('\n').splice(4);
  return '\n      '
         + colorLines('diff added',   '+ expected') + ' '
         + colorLines('diff removed', '- actual')
         + '\n\n'
         + lines.map(cleanUp).filter(notBlank).join('\n');
}
function unifiedDiff(err, escape) {
  var indent = '      ';
  function cleanUp(line) {
    if (escape) {
      line = escapeInvisibles(line);
    }
    if (line[0] === '+') return indent + colorLines('diff added', line);
    if (line[0] === '-') return indent + colorLines('diff removed', line);
    if (line.match(/\@\@/)) return null;
    if (line.match(/\\ No newline/)) return null;
    else return indent + line;
  }
  function notBlank(line) {
    return line != null;
  }
  msg = diff.createPatch('string', err.actual, err.expected);
  var lines = msg.split('\n').splice(4);
  return '\n      '
         + colorLines('diff added',   '+ expected') + ' '
         + colorLines('diff removed', '- actual')
         + '\n\n'
         + lines.map(cleanUp).filter(notBlank).join('\n');
}
function unifiedDiff ( err , escape ) { var indent = '      ' ; function cleanUp ( line ) { if ( escape ) { line = escapeInvisibles ( line ) ; } if ( line [ 0 ] === '+' ) return indent + colorLines ( 'diff added' , line ) ; if ( line [ 0 ] === '-' ) return indent + colorLines ( 'diff removed' , line ) ; if ( line . match ( / \@\@ / ) ) return null ; if ( line . match ( / \\ No newline / ) ) return null ; else return indent + line ; } function notBlank ( line ) { return line != null ; } msg = diff . createPatch ( 'string' , err . actual , err . expected ) ; var lines = msg . split ( '\n' ) . splice ( 4 ) ; return '\n      ' + colorLines ( 'diff added' , '+ expected' ) + ' ' + colorLines ( 'diff removed' , '- actual' ) + '\n\n' + lines . map ( cleanUp ) . filter ( notBlank ) . join ( '\n' ) ; }
Returns a unified diff between 2 strings

@param {Error} Error with actual/expected
@return {String} Diff
@api private
Returns a unified diff between 2 strings