 # can be overriden in the second argument.
 
 csv.toArray = (strData) ->
+  if csv.settings.removeTrailingNewlines
+    strData = removeTrailingNewlines(strData)
   strDelimiter = csv.settings.delimiter
 
   rows = []

  constructor: (param, opts={})->
    if _isString param
      @string = param
      rows = csv.toArray removeTrailingNewlines param
      @rows = arrayToObjects rows
      [@columns, @rowArray...] = rows
    else if _isArray param

  csv.fromStringArray outpArr, opts

csv.toObjects = (csvString)->
  arrayToObjects csv.toArray csvString

arrayToObjects = (arr)->
  [headRow, rows...] = arr
  for row in rows when !(row.length is 1 and row[0] is "")
    obj = {}
    for key, i in headRow
      obj[key] = row[i]
    obj

csv.toObject = (csvString, opts)->
  arrayToObject csv.toArray(csvString), opts

arrayToObject = (arr, opts={})->
  [headRow, rows...] = arr
