|
|
@ -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); |
|
|
|