Browse Source

Reordered a couple things

pull/17/head
Matthew Holt 11 years ago
parent
commit
83cb826fd7
  1. 2
      index.html
  2. 47
      jquery.parse.js

2
index.html

@ -94,7 +94,7 @@ $(function()
$('#parseFiles').click(function() $('#parseFiles').click(function()
{ {
$('#fileinput1').parse( $('#fileinput1, #fileinput2').parse(
{ {
before: function(file, inputElem) before: function(file, inputElem)
{ {

47
jquery.parse.js

@ -177,20 +177,6 @@
this.setOptions(config); this.setOptions(config);
function returnable()
{
return {
results: _state.parsed,
errors: _state.errors
};
}
function reset(input)
{
_state = emptyState();
_input = input;
}
function validConfig(config) function validConfig(config)
{ {
if (typeof config.delimiter !== 'string' if (typeof config.delimiter !== 'string'
@ -244,13 +230,9 @@
_state.i++; _state.i++;
} }
else if (delimBefore || delimAfter) else if (delimBefore || delimAfter)
{
_state.inQuotes = !_state.inQuotes; _state.inQuotes = !_state.inQuotes;
}
else else
{
addError("Quotes", "UnexpectedQuotes", "Unexpected quotes"); addError("Quotes", "UnexpectedQuotes", "Unexpected quotes");
}
} }
function inQuotes() function inQuotes()
@ -340,14 +322,6 @@
_state.field ++; _state.field ++;
} }
function endRow()
{
saveField();
var emptyLine = trimEmptyLine();
if (!emptyLine && _config.header)
inspectFieldCount();
}
function newRow() function newRow()
{ {
endRow(); endRow();
@ -362,6 +336,14 @@
_state.field = 0; _state.field = 0;
} }
function endRow()
{
saveField();
var emptyLine = trimEmptyLine();
if (!emptyLine && _config.header)
inspectFieldCount();
}
function tryParseFloat(num) function tryParseFloat(num)
{ {
var isNumber = _regex.floats.test(num); var isNumber = _regex.floats.test(num);
@ -427,6 +409,19 @@
return false; return false;
} }
function returnable()
{
return {
results: _state.parsed,
errors: _state.errors
};
}
function reset(input)
{
_state = emptyState();
_input = input;
}
} }
})(jQuery); })(jQuery);

Loading…
Cancel
Save