index.js
function csv(input, delimiter) {
  if (!input) return []
  delimiter = delimiter || ','

  var lines  = toArray(input, /\r?\n/)
  var first  = lines.shift()
  var header = toArray(first, delimiter)

  var data = lines.map(function(line) {
    var row = toArray(line, delimiter)
    return toObject(row, header)
  })

  return data
}
function csv(input, delimiter) {
  if (!input) return []
  delimiter = delimiter || ','

  var lines  = toArray(input, /\r?\n/)
  var first  = lines.shift()
  var header = toArray(first, delimiter)

  var data = lines.map(function(line) {
    var row = toArray(line, delimiter)
    return toObject(row, header)
  })

  return data
}
function csv ( input , delimiter ) { if ( ! input ) return [ ] delimiter = delimiter || ',' var lines = toArray ( input , / \r?\n / ) var first = lines . shift ( ) var header = toArray ( first , delimiter ) var data = lines . map ( function ( line ) { var row = toArray ( line , delimiter ) return toObject ( row , header ) } ) return data }
Parse a CSV string into an array of objects.

@param  {String}        input
@param  {String|RegExp} delimiter
@return {Array<Object>}

@api public
Parse a CSV string into an array of objects .