Monday, September 1, 2014

Papa Parse 3.1 released

Papa Parse 3.1 is now available. It has some edge-case bug fixes and also a few new features and enhancements.

Official release here on GitHub

Change Log

  • New config property: chunk. Specifying a chunk callback function still streams the input under the hood, but instead of getting the results row-by-row, you get the results a chunk at a time. This can still use more memory than specifying a step callback, but for very large files (say a million rows), invoking a function 10,000 times may be faster than invoking a function 1,000,000 times. Remember the chunk size is customizable.

  • New config property: keepEmptyRows. Sometimes it's important to maintain row parity with the input, for example, when you want some output to match row-for-row with the input. Rows that are empty are skipped and it can be impossible to know where empty lines were otherwise.

  • New config property: error. Actually, this appeared in the source code already but wasn't documented nor was it used where it should have been. The error callback gets executed if FileReader encounters a problem opening the file.

  • New feature: Pause and resume parsing. This only works without a worker thread. The step callback is passed a ParserHandle which has pause and resume functions exposed. This makes the parse function asynchronous if it wasn't already, but allows you to do other asynchronous things during parsing, for example, AJAX requests.

  • Enhancement: Meta has a new property called truncated. This value will be true if using preview and the preview did not parse all the results because they were longer than the preview length. It will be false if the preview was able to parse the entire input.

  • Fix: The preview value included the header row; in other words, a preview of 10 would produce 9 rows if the first row was a header row. Now, a preview of 10 parses 11 rows so that 10 are data rows.

  • New option: Papa.DefaultDelimiter. The default is comma, but specify a different (and valid) delimiter in the cases when a delimiter is not specified and detection fails.

  • Firefox fix: FileReader in worker thread. Firefox does not (currently) have FileReader in worker contexts. But it looks like they've considered that a bug and will be rolling it out in future versions of Firefox.

  • Fix: When converting JSON to CSV, null value is interpreted as empty string, whereas before an exception was thrown.

  • Fix: Using complete callback with a worker thread.

  • Fix: Escaped quotes in quoted field edge case.