question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: csv is undefined

See original GitHub issue

Subject of the issue

I love your library and I DEARLY want to use it, but it seems to have a problem loading in Firefox on client side.

Environment

  • Platform: Browser
  • Version: Firefox (up to date as of 2018/04/10)

Steps to reproduce

  • in the html: <script type="text/javascript" src="js/jquery.csv.js"></script>
  • in the index.js: var result = $.csv.toArrays(getTableString("docs/ef-fc-db-stringReadable.csv"));

Expected behavior

jquery-csv loads properly, result variable contains the 2-d array from that string

Actual behaviour

TypeError: csv is undefined - jquery.csv.js:169:9

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
evanplaicecommented, Feb 26, 2019

The likely cause is that some library is loaded after jquery-csv that deletes or mutates the $/jQuery namespace

The load order should be:

  1. jQuery
  2. jquery-csv

Attaching to global namespaces in general is a ‘bad’ idea and will likely become an anti-pattern of developing JS libraries going forward. This library functioning as an extension of the jQuery namespace is an unfortunate artifact of the time it was originally written.

There are plans to provide to re-implement it as an ES module, completely independent of jQuery once ESM support is fully stable and available in browsers/node.

1reaction
nek2712commented, Feb 20, 2019

@jonathansekela Hey I was facing the same issue and discovered that it was because the argument passed to $.csv.toArrays() was undefined, check what your <<getTableString(“docs/ef-fc-db-stringReadable.csv”)>> is returning.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReferenceError: CSV is not defined - javascript - Stack Overflow
You code is executed before browser loads the CSV script. Wrap you JavaScript code with $( document ).ready(function() { // PUT YOUR ...
Read more >
Error using jquery-csv: $.csv is undefined
Recently in one web project I had to convert csv data to javascript objects. Quick DuckDuckGo research has shown me library which suits...
Read more >
CSV Parse - Options
Affects the result data set in the sense that records will be objects instead of arrays. A value "false" "null", or "undefined" inside...
Read more >
CSV Export - Kibana.log error - TypeError - Elastic Discuss
Below error message is occuring in kibana.log while the CSV export is running. TypeError: Cannot read property 'convert' of undefined at ...
Read more >
I get the message "Undefined" when I upload a CSV.
There are known cases when users try to upload a .csv and get a message saying "undefined". This is caused by CSV-files which...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found