From 83cb826fd73ecea6c8298b82d14eac7fc8c47ed2 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Fri, 13 Dec 2013 16:18:14 -0700 Subject: [PATCH] Reordered a couple things --- index.html | 2 +- jquery.parse.js | 47 +++++++++++++++++++++-------------------------- 2 files changed, 22 insertions(+), 27 deletions(-) diff --git a/index.html b/index.html index 47f9c13..aa8cf33 100644 --- a/index.html +++ b/index.html @@ -94,7 +94,7 @@ $(function() $('#parseFiles').click(function() { - $('#fileinput1').parse( + $('#fileinput1, #fileinput2').parse( { before: function(file, inputElem) { diff --git a/jquery.parse.js b/jquery.parse.js index c1321d8..cc41565 100644 --- a/jquery.parse.js +++ b/jquery.parse.js @@ -177,20 +177,6 @@ this.setOptions(config); - function returnable() - { - return { - results: _state.parsed, - errors: _state.errors - }; - } - - function reset(input) - { - _state = emptyState(); - _input = input; - } - function validConfig(config) { if (typeof config.delimiter !== 'string' @@ -244,13 +230,9 @@ _state.i++; } else if (delimBefore || delimAfter) - { _state.inQuotes = !_state.inQuotes; - } else - { addError("Quotes", "UnexpectedQuotes", "Unexpected quotes"); - } } function inQuotes() @@ -340,14 +322,6 @@ _state.field ++; } - function endRow() - { - saveField(); - var emptyLine = trimEmptyLine(); - if (!emptyLine && _config.header) - inspectFieldCount(); - } - function newRow() { endRow(); @@ -362,6 +336,14 @@ _state.field = 0; } + function endRow() + { + saveField(); + var emptyLine = trimEmptyLine(); + if (!emptyLine && _config.header) + inspectFieldCount(); + } + function tryParseFloat(num) { var isNumber = _regex.floats.test(num); @@ -427,6 +409,19 @@ return false; } + function returnable() + { + return { + results: _state.parsed, + errors: _state.errors + }; + } + + function reset(input) + { + _state = emptyState(); + _input = input; + } } })(jQuery);