function loadFileAsObj(inputFile){
  var reader = new FileReader();
  reader.readAsText(inputFile, "UTF-8");
  reader.onloadend = function () {
    var text = reader.result;
    array.results.file = [];
    if(text.split('\n')[0].split(",").length>22){array.results.file.push('Invalid header field count')};
    if(text.split('\n')[1].split(",").length>22){array.results.file.push('Invalid data field count')}
    var data = $.csv.toObjects(text);
    var data = data.filter(data => data._id != '');
    arrayDimensions(data);
    checkFile(data);
    inputProducts(data);
    arrayProducts(data);
    console.log(array);
  };
}
// Import CSV data in to an Object
Import CSV data in to an Object
Import CSV data in to an Object
function loadFileAsObj(inputFile){
  var reader = new FileReader();
  reader.readAsText(inputFile, "UTF-8");
  reader.onloadend = function () {
    var text = reader.result;
    array.results.file = [];
    if(text.split('\n')[0].split(",").length>22){array.results.file.push('Invalid header field count')};
    if(text.split('\n')[1].split(",").length>22){array.results.file.push('Invalid data field count')}
    var data = $.csv.toObjects(text);
    var data = data.filter(data => data._id != '');
    arrayDimensions(data);
    checkFile(data);
    inputProducts(data);
    arrayProducts(data);
    console.log(array);
  };
}
function loadFileAsObj ( inputFile ) { var reader = new FileReader ( ) ; reader . readAsText ( inputFile , "UTF-8" ) ; reader . onloadend = function ( ) { var text = reader . result ; array . results . file = [ ] ; if ( text . split ( '\n' ) [ 0 ] . split ( "," ) . length > 22 ) { array . results . file . push ( 'Invalid header field count' ) } ; if ( text . split ( '\n' ) [ 1 ] . split ( "," ) . length > 22 ) { array . results . file . push ( 'Invalid data field count' ) } var data = $ . csv . toObjects ( text ) ; var data = data . filter ( data => data . _id != '' ) ; arrayDimensions ( data ) ; checkFile ( data ) ; inputProducts ( data ) ; arrayProducts ( data ) ; console . log ( array ) ; } ; }
Import CSV data in to an Object
Import CSV data in to an Object