
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
csv-table-parser
Advanced tools
npm install csv-table-parser
csv file convert to object array like below.
const { parser } = require('csv-table-parser')
const input = `name, age, email, isMember
alice, 15, alice@xxx.com, true
bob, 25, bob@xxx.com, false
`
parser(input)
/*
*[
* { name: "alice", age: 15, email: "alice@xxx.com", isMember: true },
* { name: "bob", age: 25, email: "bob@xxx.com", isMember: false }
*]
*/
you can also convert to array in array.
const { parser } = require('csv-table-parser')
const input = `alice, 15, alice@xxx.com, true
bob, 25, bob@xxx.com, false
`
parser(input, { type: 'array' })
/*
*[
* [ "alice", 15, "alice@xxx.com", true ],
* [ "bob", 25, "bob@xxx.com", false ]
*]
*/
second parameter is options. the example is below.
const input = `name age email isMember
alice 15 alice@xxx.com true
bob 25 bob@xxx.com false
`
parser(input, { separator: '\t' })
/*
*[
* { name: "alice", age: 15, email: "alice@xxx.com", isMember: true },
* { name: "bob", age: 25, email: "bob@xxx.com", isMember: false }
*]
*/
const input = `customer name, customer age, customer email for customer service, this user is member or not
name, age, email, isMember
alice, 15, alice@xxx.com, true
bob, 25, bob@xxx.com, false
`
parser(input, { startRow: 1 })
/*
*[
* { name: "alice", age: 15, email: "alice@xxx.com", isMember: true },
* { name: "bob", age: 25, email: "bob@xxx.com", isMember: false }
*]
*/
const input = `no, name, age, email, isMember
1, alice, 15, alice@xxx.com, true
2, bob, 25, bob@xxx.com, false
`
parser(input, { startColumn: 1 })
/*
*[
* { name: "alice", age: 15, email: "alice@xxx.com", isMember: true },
* { name: "bob", age: 25, email: "bob@xxx.com", isMember: false }
*]
*/
const input = `name, age, email, isMember
alice, 15, alice@xxx.com, true
bob, 25, bob@xxx.com, false
`
parser(input, { numberOfColumn: 3 })
/*
*[
* { name: "alice", age: 15, email: "alice@xxx.com" },
* { name: "bob", age: 25, email: "bob@xxx.com" }
*]
*/
const input = `name, age, email, isMember
alice, 15, alice@xxx.com,
bob, 25, bob@xxx.com, true
`
parser(input, { defaultValue: false })
/*
*[
* { name: "alice", age: 15, email: "alice@xxx.com", isMember: false },
* { name: "bob", age: 25, email: "bob@xxx.com", isMember: true }
*]
*/
FAQs
convert csv to object array
The npm package csv-table-parser receives a total of 1 weekly downloads. As such, csv-table-parser popularity was classified as not popular.
We found that csv-table-parser 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.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.