Giter VIP home page Giter VIP logo

csv.js's Issues

Uncaught TypeError: this._store.query is not a function in recline model using csv backend

We are using the recline library to instantiate a csv backend to generate charts using nvd3, however I am getting an error that I do not understand:

Uncaught TypeError: this._store.query is not a function

The error is coming from the recline model on line 201 (the dataset->query method):

this._store.query(actualQuery, this.toJSON()) ...

The dataset instance in question is using the csv backend, which (when I output it to the console on model init) does not seem to have a query method set on it. Consequently, when this._store is set to backend by the dataset model there is no query method and the above error is thrown.

I'm unclear why I'm seeing this behavior and am wondering if anyone has any insight.

CSV parser should respect escaped quotes

Originally from @amercader here datopian/datahub#304.

The background for this is trying to store a GeoJSON string in a CSV to display it on the map view. Recline won't parse this correctly:

name,geom
Test, "{\"type\":\"Point\",\"coordinates\":[-1.1207,45.4874]}"

The following will work, but it is not always possible to define the text delimiter, eg in CKAN (Note the single quote):

name,geom
Test, '{"type":"Point","coordinates":[-1.1207,45.4874]}'

Dialect options are ignored when parsing

You are passing the dataset to the parse function, but it assumes you get the dialect hash, so it will not reach down from the dataset to the dialect hash so the dialect options are ignored and the default options are used.
FIX1: Rename parse function argument dialect to dataset and create local variable dialect from the dataset
FIX2: Pass dialect hash to parse function

Shipped csv.min.js is out of date

The csv.min.js on the master branch hasn't been updated since commit 5cb7c7 in 2016. There have been a couple of changes to csv.js since then that I was surprised weren't reflected in the minified version.

unable to make it RFC

I was trying to make it closer to RFC, but realized that parsing is used default values. So if I have CSV pipe delimited like
A|B|C
There is no way to pass custom options due to a bug: while m.parse takes options from which it takes delimiter, those options are internal hardcoded
image

In 'fetch' method there is no way to pass custom options to override delimiter with own
image

While can pass custom dialect/options to serialize, the parse options are hardcoded in my.normalizeDialectOptions

Reject fetch promise when the ajax request fails

Since the fetch promise is not being rejected when the ajax call fails then I didn't find a way to handle request errors.

It would be nice to do something like this:

CSV.fetch(dataset)
  .done(function(data){....})
  .fail(function(error){ console.log(error); });

Working in a PR.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.