Socket
Socket
Sign inDemoInstall

@simwrapper/papaparse

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.3.2-2 to 5.3.2-3

2

package.json
{
"name": "@simwrapper/papaparse",
"version": "5.3.2-2",
"version": "5.3.2-3",
"description": "CSV parser for the browser, modified for SimWrapper to handle quoted text strings sanely",

@@ -5,0 +5,0 @@ "keywords": [

@@ -0,1 +1,29 @@

SimWrapper version of Papa Parse
================================
SimWrapper uses a modified version of the CSV-parsing "Papaparse" library to address what we consider a bug in Papaparse's handling of quoted string fields and to enhance comment support.
### 1. Quoted fields
Papaparse has a nice "dynamic typing" feature which converts numeric and boolean fields into actual numbers and booleans in the javascript objects that it returns. Unfortunately, it will convert fields even if they are surrounded by double-quotes. This is absolutely counterintuitive, because our users (most people generally?) use double-quotes to declare that a field is a string, full-stop.
This behavior causes big problems when a field contains something like a US ZIP Code, for example. Boston's ZIP code is 02134. Papaparse returns that as the number 2,134, which is WRonG!
We've also encountered network files where link ID's have leading zeroes, and these also end up getting parsed incorrectly.
Users know that putting double-quotes around a field in Excel will force Excel to interpret that cell as a string even if its content is numeric.
So, this patched version of PapaParse does the same thing: Even when the library's dynamic typing option is enabled, fields surrounded with double-quotes will be returned as strings, not numbers/booleans.
### 2. Comments in CSV files
Papaparse includes an option to skip lines beginning with a comment tag, and SimWrapper uses the `#` hash/number sign to mark lines that are to be skipped.
But Papaparse throws these comments away, whereas SimWrapper would like to get some meta information
about the CSV file using comments. For example, some SimWrapper plugins look for the EPSG coordinate reference system code in comments.
So this modified version of Papaparse builds an array called `comments` containing the list of comment lines that is
returned as part of the `{data, meta, errors, comments}` object that Papaparse returns.
Parse CSV with JavaScript

@@ -2,0 +30,0 @@ ========================================

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc