examples/ny-campaign-finance.conf.js
function(line) {
    line = line.toString();
    var colCount = _.size(transactionFields);
    var possibleRow = row + line;
    var possibleFields = possibleRow.slice(1, possibleRow.length - 1).split("\",\"");

    // Unfortunately there are some fields that have new line characters in them
    // and there could be exta commas
    if (line.slice(-1) !== "\"" || possibleFields.length < colCount) {
      row = row + line;
      return false;
    }
    // Otherwise just use what we have
    else {
      line = row + line;
      row = "";
    }

    // Parse and match with headers
    var fields = line.slice(1, line.length - 1).split("\",\"");
    var parsed = {};
    _.each(_.keys(transactionFields), function(h, hi) {
      parsed[h] = fields[hi];
    });

    // Use auto parser to coerce the types
    parsed = this.autoParser(parsed, this.options.models, {
      dateFormat: this.options.dateFormat,
      datetimeFormat: this.options.datetimeFormat
    });

    //checkFieldLength(parsed, "other_receipt_code");

    return parsed;
  }
function(line) {
    line = line.toString();
    var colCount = _.size(transactionFields);
    var possibleRow = row + line;
    var possibleFields = possibleRow.slice(1, possibleRow.length - 1).split("\",\"");

    // Unfortunately there are some fields that have new line characters in them
    // and there could be exta commas
    if (line.slice(-1) !== "\"" || possibleFields.length < colCount) {
      row = row + line;
      return false;
    }
    // Otherwise just use what we have
    else {
      line = row + line;
      row = "";
    }

    // Parse and match with headers
    var fields = line.slice(1, line.length - 1).split("\",\"");
    var parsed = {};
    _.each(_.keys(transactionFields), function(h, hi) {
      parsed[h] = fields[hi];
    });

    // Use auto parser to coerce the types
    parsed = this.autoParser(parsed, this.options.models, {
      dateFormat: this.options.dateFormat,
      datetimeFormat: this.options.datetimeFormat
    });

    //checkFieldLength(parsed, "other_receipt_code");

    return parsed;
  }
function ( line ) { line = line . toString ( ) ; var colCount = _ . size ( transactionFields ) ; var possibleRow = row + line ; var possibleFields = possibleRow . slice ( 1 , possibleRow . length - 1 ) . split ( "\",\"" ) ; // Unfortunately there are some fields that have new line characters in them // and there could be exta commas if ( line . slice ( - 1 ) !== "\"" || possibleFields . length < colCount ) { row = row + line ; return false ; } // Otherwise just use what we have else { line = row + line ; row = "" ; } // Parse and match with headers var fields = line . slice ( 1 , line . length - 1 ) . split ( "\",\"" ) ; var parsed = { } ; _ . each ( _ . keys ( transactionFields ) , function ( h , hi ) { parsed [ h ] = fields [ hi ] ; } ) ; // Use auto parser to coerce the types parsed = this . autoParser ( parsed , this . options . models , { dateFormat : this . options . dateFormat , datetimeFormat : this . options . datetimeFormat } ) ; //checkFieldLength(parsed, "other_receipt_code"); return parsed ; }
Comes in as buffer
Comes in as buffer