Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
csv-array
Advanced tools
Readme
#csv-array
Simple. lighweight, intelligent CSV-parser for nodeJS
This package got only one dependencies of "line-by-line".
The installation is just a command
npm install csv-array
After installing the package you can use the "parseCSV" method as follows
parseCSV("CSV-file-name.csv", callBack, considerFirstRowAsHeading)
/*
Where callBack is the method which have the output array as argument, and you can do
anything you like inside the function with the array
"considerFirstRowAsHeading" is a configuration variable which holds "true" value
by default. If it is true or nothing then the first row of the csv data will be considered
as heading and the out put data will use the first row's content as attribute names.
If it is "false" then all of the rows of the file will be returned as array.
See example below.
*/
test.csv file contains
Question Statement,Option 1,Option 2,Option 3,Option 4,Option 5,Answer,Deficulty,Category
this is a test question answer it?,answer 1,answer 2,answer3,answer 4,,answer 2,3,test
this is another test question answer it?,"answer1,answer2","answer2,answer3","answer4,answer5","answer5,answer6","answer7,answer8","answer1,answer2",2,test
var csv = require('csv-array');
csv.parseCSV("test.csv", function(data){
console.log(JSON.stringify(data));
});
Output
[
{
"Question Statement":"this is a test question answer it?",
"Option 1":"answer 1",
"Option 2":"answer 2",
"Option 3":"answer3",
"Option 4":"answer 4",
"Option 5":"",
"Answer":"answer 2",
"Deficulty":"3",
"Category":"test"
},
{
"Question Statement":"this is another test question answer it?",
"Option 1":"answer1,answer2",
"Option 2":"answer2,answer3",
"Option 3":"answer4,answer5",
"Option 4":"answer5,answer6",
"Option 5":"answer7,answer8",
"Answer":"answer1,answer2",
"Deficulty":"2",
"Category":"test"
}
]
var csv = require('csv-array');
csv.parseCSV("test.csv", function(data){
console.log(JSON.stringify(data));
}, false);
Output
[
[
"Question Statement",
"Option 1",
"Option 2",
"Option 3",
"Option 4",
"Option 5",
"Answer",
"Deficulty",
"Category"
],
[
"this is a test question answer it?",
"answer 1",
"answer 2",
"answer3",
"answer 4",
"",
"answer 2",
"3",
"test"
],
[
"this is another test question answer it?",
"answer1,answer2",
"answer2,answer3",
"answer4,answer5",
"answer5,answer6",
"answer7,answer8",
"answer1,answer2",
"2",
"test"
]
]
var csv = require('csv-array');
csv.parseCSV("test.csv", function(data){
console.log(JSON.stringify(data));
}, true);
/*
The output will be as same as
var csv = require('csv-array');
csv.parseCSV("test.csv", function(data){
console.log(JSON.stringify(data));
});
*/
Output
[
{
"Question Statement":"this is a test question answer it?",
"Option 1":"answer 1",
"Option 2":"answer 2",
"Option 3":"answer3",
"Option 4":"answer 4",
"Option 5":"",
"Answer":"answer 2",
"Deficulty":"3",
"Category":"test"
},
{
"Question Statement":"this is another test question answer it?",
"Option 1":"answer1,answer2",
"Option 2":"answer2,answer3",
"Option 3":"answer4,answer5",
"Option 4":"answer5,answer6",
"Option 5":"answer7,answer8",
"Answer":"answer1,answer2",
"Deficulty":"2",
"Category":"test"
}
]
If any issue found feel free to contact me at sguha1988.life@gmail.com
FAQs
Intelligent CSV parser created and made for nodeJS. Which takes a csv file and produce an array from it.
The npm package csv-array receives a total of 854 weekly downloads. As such, csv-array popularity was classified as not popular.
We found that csv-array demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.