javascriptjqueryreactjsjquery-csv

Trouble using jquery-csv library


As I am using React in ES6 and am using Jquery-CSV library, I was unable to import using

var $ = jQuery = require('jquery');
require('./jquery.csv.js');

Found a way to import using

import * as randomName from 'jquery-csv'

Now how am I able to use

$.csv.toArrays(csv);```/```$.csv.toObjects(csv);?

I tried to play around by using names as prefix like randomName.csv.toArrays() but no luck.

EDIT:


randomName.toArray(csv); this works,

but now I am getting the following error

TypeError: csv.replace is not a function

How to solve this?


Solution

  • Able to access the library and while passing string as input, I am able to get the them in Array.

    input="This is a Random string"

    randomName.csv.toArray(input)

    Output: ["This is a Random string"]