index.js
function unifiedDiff (actual, expected, formatAdd, formatRem) {
  return [
    formatAdd('+ expected'),
    formatRem('- actual'),
    ''
  ]
    .concat(
      diff.createPatch('string', actual, expected)
        .split('\n')
        .slice(4)
        .filter(function (line) {
          return line[0] === '+' || line[0] === '-'
        })
        .map(function (line) {
          return line[0] === '+' ? formatAdd(line) : formatRem(line)
        })
    )
    .join('\n')
}
function unifiedDiff (actual, expected, formatAdd, formatRem) {
  return [
    formatAdd('+ expected'),
    formatRem('- actual'),
    ''
  ]
    .concat(
      diff.createPatch('string', actual, expected)
        .split('\n')
        .slice(4)
        .filter(function (line) {
          return line[0] === '+' || line[0] === '-'
        })
        .map(function (line) {
          return line[0] === '+' ? formatAdd(line) : formatRem(line)
        })
    )
    .join('\n')
}
function unifiedDiff ( actual , expected , formatAdd , formatRem ) { return [ formatAdd ( '+ expected' ) , formatRem ( '- actual' ) , '' ] . concat ( diff . createPatch ( 'string' , actual , expected ) . split ( '\n' ) . slice ( 4 ) . filter ( function ( line ) { return line [ 0 ] === '+' || line [ 0 ] === '-' } ) . map ( function ( line ) { return line [ 0 ] === '+' ? formatAdd ( line ) : formatRem ( line ) } ) ) . join ( '\n' ) }
Return unified diff of actual vs expected.

@param {*} actual Actual value
@param {*} expected Expected value
@param {function} formatAdd Addition formatter
@param {function} formatRem Removal formatter
@return {string}
Return unified diff of actual vs expected .