Browse Source

Explaining results in docs

pull/1/head
Matthew Holt 11 years ago
parent
commit
8ef9ee3a4f
  1. 45
      README.md

45
README.md

@ -16,4 +16,47 @@ results = $.parse(csvString, { @@ -16,4 +16,47 @@ results = $.parse(csvString, {
The default delimiter is `,` but can be set to anything anything except `"` or `\n`.
By default, a header row is expected. The output and error handling depends on whether you include a header row with your data.
By default, a header row is expected. The output and error handling depends on whether you include a header row with your data.
**If `header: true`, the output looks like:**
```javascript
{
errors: [
// errors, if any (parsing should not throw exceptions)
],
results: {
fields: [
// field names from the header row
],
rows: [
// objects, where each field value is keyed to the field name
]
}
}
```
**If `header: false`, the output looks like:**
```javascript
{
errors: [
// errors, if any (parsing should not throw exceptions)
],
results: [
// each row is itself an array of values separated by delimiter
]
}
```
**Errors look like:**
```javascript
{
message: "", // Human-readable message
line: 0, // Line of original input
row: 0, // Row index where error was
index: 0 // Character index within original input
}
```
Loading…
Cancel
Save