csv
Advanced tools
Comparing version 5.5.3 to 6.0.0
@@ -1,13 +0,14 @@ | ||
// Alias to the ES6 modules exposing the stream and callback APIs | ||
import * as generateImport from 'csv-generate'; | ||
import * as parseImport from 'csv-parse'; | ||
import * as transformImport from 'stream-transform'; | ||
import * as stringifyImport from 'csv-stringify'; | ||
// Alias to the modules exposing the stream and callback APIs | ||
export var generate: typeof generateImport; | ||
export var parse: typeof parseImport; | ||
export var transform: typeof transformImport; | ||
export var stringify: typeof stringifyImport; | ||
import { generate } from 'csv-generate'; | ||
import { parse } from 'csv-parse'; | ||
import { transform } from 'stream-transform'; | ||
import { stringify } from 'csv-stringify'; | ||
export as namespace csv; | ||
export { generate, parse, transform, stringify }; | ||
export * as generator from 'csv-generate'; | ||
export * as parser from 'csv-parse'; | ||
export * as transformer from 'stream-transform'; | ||
export * as stringifier from 'csv-stringify'; |
// Alias to the ES6 modules exposing the stream and callback APIs | ||
// Alias to the modules exposing the stream and callback APIs | ||
module.exports = { | ||
generate: require('csv-generate/lib'), | ||
parse: require('csv-parse/lib'), | ||
transform: require('stream-transform/lib'), | ||
stringify: require('csv-stringify/lib') | ||
} | ||
import { generate } from 'csv-generate'; | ||
import { parse } from 'csv-parse'; | ||
import { transform } from 'stream-transform'; | ||
import { stringify } from 'csv-stringify'; | ||
export { generate, parse, stringify, transform }; |
@@ -1,13 +0,14 @@ | ||
// Alias to the ES6 modules exposing the stream and callback APIs | ||
//import * as generate from "csv-generate/lib/sync"; | ||
import * as parseImport from 'csv-parse/lib/sync'; | ||
import * as transformImport from 'stream-transform/lib/sync'; | ||
import * as stringifyImport from 'csv-stringify/lib/sync'; | ||
// Alias to the modules exposing the sync APIs | ||
//export var generate: typeof generateImport, | ||
export var parse: typeof parseImport; | ||
export var transform: typeof transformImport; | ||
export var stringify: typeof stringifyImport; | ||
import { generate } from 'csv-generate/sync' | ||
import { parse } from 'csv-parse/sync'; | ||
import { transform } from 'stream-transform/sync'; | ||
import { stringify } from 'csv-stringify/sync'; | ||
export as namespace csv; | ||
export { generate, parse, transform, stringify } | ||
export * as generator from 'csv-generate/sync'; | ||
export * as parser from 'csv-parse/sync'; | ||
export * as transformer from 'stream-transform/sync'; | ||
export * as stringifier from 'csv-stringify/sync'; |
// Alias to the ES6 modules exposing the sync API | ||
// Alias to the modules exposing the sync API | ||
module.exports = { | ||
generate: require('csv-generate/lib/sync'), | ||
parse: require('csv-parse/lib/sync'), | ||
transform: require('stream-transform/lib/sync'), | ||
stringify: require('csv-stringify/lib/sync') | ||
} | ||
import { generate } from 'csv-generate/sync'; | ||
import { parse } from 'csv-parse/sync'; | ||
import { stringify } from 'csv-stringify/sync'; | ||
import { transform } from 'stream-transform/sync'; | ||
export { generate, parse, stringify, transform }; |
125
package.json
{ | ||
"name": "csv", | ||
"version": "5.5.3", | ||
"version": "6.0.0", | ||
"description": "A mature CSV toolset with simple api, full of options and tested against large datasets.", | ||
@@ -18,3 +18,2 @@ "keywords": [ | ||
], | ||
"homepage": "https://csv.js.org/", | ||
"bugs": "https://github.com/adaltas/node-csv/issues", | ||
@@ -25,65 +24,87 @@ "author": "David Worms <david@adaltas.com> (https://www.adaltas.com)", | ||
], | ||
"license": "MIT", | ||
"engines": { | ||
"node": ">= 0.1.90" | ||
}, | ||
"main": "./lib", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/adaltas/node-csv.git" | ||
}, | ||
"coffeelintConfig": { | ||
"indentation": { | ||
"level": "error", | ||
"value": 2 | ||
}, | ||
"line_endings": { | ||
"level": "error", | ||
"value": "unix" | ||
}, | ||
"max_line_length": { | ||
"level": "ignore" | ||
} | ||
}, | ||
"dependencies": { | ||
"csv-generate": "^3.4.3", | ||
"csv-parse": "^4.16.3", | ||
"csv-stringify": "^5.6.5", | ||
"stream-transform": "^2.1.3" | ||
"csv-generate": "^4.0.0", | ||
"csv-parse": "^5.0.0", | ||
"csv-stringify": "^6.0.0", | ||
"stream-transform": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.15.0", | ||
"@rollup/plugin-eslint": "^8.0.1", | ||
"@rollup/plugin-node-resolve": "^13.0.6", | ||
"@types/mocha": "^9.0.0", | ||
"@types/node": "^16.7.8", | ||
"@types/node": "^16.11.7", | ||
"@types/should": "^13.0.0", | ||
"babelify": "^10.0.0", | ||
"browserify": "^17.0.0", | ||
"coffeescript": "~2.5.1", | ||
"mocha": "~9.1.1", | ||
"coffeescript": "~2.6.1", | ||
"eslint": "^8.2.0", | ||
"mocha": "~9.1.3", | ||
"rollup": "^2.60.0", | ||
"rollup-plugin-node-builtins": "^2.1.2", | ||
"rollup-plugin-node-globals": "^1.4.0", | ||
"should": "~13.2.3", | ||
"ts-node": "^10.2.1", | ||
"typescript": "^4.4.2" | ||
"ts-node": "^10.4.0", | ||
"typescript": "^4.4.4" | ||
}, | ||
"engines": { | ||
"node": ">= 0.1.90" | ||
}, | ||
"exports": { | ||
".": { | ||
"import": "./lib/index.js", | ||
"require": "./dist/cjs/index.cjs" | ||
}, | ||
"./sync": { | ||
"import": "./lib/sync.js", | ||
"require": "./dist/cjs/sync.cjs" | ||
} | ||
}, | ||
"homepage": "https://csv.js.org/", | ||
"files": [ | ||
"dist", | ||
"lib", | ||
"samples" | ||
], | ||
"license": "MIT", | ||
"main": "./dist/cjs/index.cjs", | ||
"mocha": { | ||
"throw-deprecation": true, | ||
"inline-diffs": true, | ||
"loader": "./test/loaders/all.mjs", | ||
"recursive": true, | ||
"reporter": "spec", | ||
"require": [ | ||
"should", | ||
"coffeescript/register", | ||
"ts-node/register" | ||
"should" | ||
], | ||
"inline-diffs": true, | ||
"timeout": 40000, | ||
"reporter": "spec", | ||
"recursive": true | ||
"throw-deprecation": true, | ||
"timeout": 40000 | ||
}, | ||
"files": [ | ||
"lib" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/adaltas/node-csv.git", | ||
"directory": "packages/csv" | ||
}, | ||
"scripts": { | ||
"build": "browserify lib/index.js --transform babelify --standalone parse > lib/browser/index.js && browserify lib/sync.js --transform babelify --standalone parse > lib/browser/sync.js", | ||
"preversion": "cp lib/*.ts lib/es5 && git add lib/es5/*.ts", | ||
"test": "mocha test/**/*.{coffee,ts}" | ||
"build": "npm run build:rollup && npm run build:ts", | ||
"build:rollup": "npx rollup -c", | ||
"build:ts": "cp lib/*.ts dist/cjs && cp lib/*.ts dist/esm", | ||
"lint": "npm run lint:lib && npm run lint:samples && npm run lint:test", | ||
"lint:lib": "eslint --fix lib/*.js", | ||
"lint:samples": "eslint --fix samples/*.js", | ||
"lint:test": "coffeelint --fix test/*.coffee", | ||
"preversion": "npm run build && git add dist", | ||
"pretest": "npm run build", | ||
"test": "mocha 'test/**/*.{coffee,ts}'", | ||
"test:legacy": "mocha --loader=./test/loaders/legacy/all.mjs 'test/**/*.{coffee,ts}'" | ||
}, | ||
"types": "./lib/index.d.ts", | ||
"gitHead": "0fd5209b6862655c384cda052abf38019b959e70" | ||
"type": "module", | ||
"types": "dist/esm/index.d.ts", | ||
"typesVersions": { | ||
"*": { | ||
".": [ | ||
"dist/esm/index.d.ts" | ||
], | ||
"sync": [ | ||
"dist/esm/sync.d.ts" | ||
] | ||
} | ||
}, | ||
"gitHead": "d95c35dc7fd698e8e3278f539c8f1d43fb77640b" | ||
} |
<pre> | ||
_ _ _ _____ _______ __ | ||
| \ | | | | / ____|/ ____\ \ / / | ||
| \| | ___ __| | ___ | | | (___ \ \ / / | ||
| . ` |/ _ \ / _` |/ _ \| | \___ \ \ \/ / | ||
| |\ | (_) | (_| | __/| |____ ____) | \ / | ||
|_| \_|\___/ \__,_|\___| \_____|_____/ \/ MIT License | ||
# CSV for Node.js and the web | ||
</pre> | ||
[![Build Status](https://img.shields.io/github/workflow/status/adaltas/node-csv/Node.js)](https://github.com/adaltas/node-csv/actions) | ||
[![NPM](https://img.shields.io/npm/dm/csv)](https://www.npmjs.com/package/csv) [![NPM](https://img.shields.io/npm/v/csv)](https://www.npmjs.com/package/csv) | ||
This project provides CSV generation, parsing, transformation and serialization | ||
The `csv` project provides CSV generation, parsing, transformation and serialization | ||
for Node.js. | ||
@@ -19,19 +14,17 @@ | ||
[![NPM](https://img.shields.io/npm/dm/csv)](https://www.npmjs.com/package/csv) [![NPM](https://img.shields.io/npm/v/csv)](https://www.npmjs.com/package/csv) | ||
This package exposes 4 packages: | ||
The `csv` package is itself split into 4 packages: | ||
* [`csv-generate`](https://csv.js.org/generate/) | ||
([GitHub](https://github.com/adaltas/node-csv/tree/master/packages/csv-generate)), | ||
a flexible generator of CSV string and Javascript objects. | ||
* [`csv-parse`](https://csv.js.org/parse/) | ||
([GitHub](https://github.com/adaltas/node-csv/tree/master/packages/csv-parse)), | ||
a parser converting CSV text into arrays or objects. | ||
* [`csv-stringify`](https://csv.js.org/stringify/) | ||
([GitHub](https://github.com/adaltas/node-csv/tree/master/packages/csv-stringify)), | ||
a stringifier converting records into a CSV text. | ||
* [`stream-transform`](https://csv.js.org/transform/) | ||
([GitHub](https://github.com/adaltas/node-csv/tree/master/packages/stream-transform)), | ||
a transformation framework. | ||
* [`csv-generate`](https://csv.js.org/generate/), | ||
a flexible generator of CSV string and Javascript objects. | ||
[![Build Status](https://secure.travis-ci.org/adaltas/node-csv-generate.svg?branch=master)][travis-csv-generate] | ||
* [`csv-parse`](https://csv.js.org/parse/), | ||
a parser converting CSV text into arrays or objects. | ||
[![Build Status](https://secure.travis-ci.org/adaltas/node-csv-parse.svg?branch=master)][travis-csv-parse] | ||
* [`stream-transform`](https://csv.js.org/transform/), | ||
a transformation framework. | ||
[![Build Status](https://secure.travis-ci.org/adaltas/node-stream-transform.svg?branch=master)][travis-stream-transform] | ||
* [`csv-stringify`](https://csv.js.org/stringify/), | ||
a stringifier converting records into a CSV text. | ||
[![Build Status](https://secure.travis-ci.org/adaltas/node-csv-stringify.svg?branch=master)][travis-csv-stringify] | ||
## Documentation | ||
@@ -48,2 +41,35 @@ | ||
## Sample | ||
This example uses the Stream API to create a processing pipeline. | ||
```js | ||
// Import the package | ||
import * as csv from '../lib/index.js'; | ||
// Run the pipeline | ||
csv | ||
// Generate 20 records | ||
.generate({ | ||
delimiter: '|', | ||
length: 20 | ||
}) | ||
// Transform CSV data into records | ||
.pipe(csv.parse({ | ||
delimiter: '|' | ||
})) | ||
// Transform each value into uppercase | ||
.pipe(csv.transform((record) => { | ||
return record.map((value) => { | ||
return value.toUpperCase(); | ||
}); | ||
})) | ||
// Convert objects into a stream | ||
.pipe(csv.stringify({ | ||
quoted: true | ||
})) | ||
// Print the CSV stream to stdout | ||
.pipe(process.stdout); | ||
``` | ||
## Development | ||
@@ -56,2 +82,8 @@ | ||
## Contributors | ||
The project is sponsored by [Adaltas](https://www.adaltas.com), an Big Data consulting firm based in Paris, France. | ||
* David Worms: <https://github.com/wdavidw> | ||
## Related projects | ||
@@ -58,0 +90,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
2097657
24
52184
97
0
1
Yes
14
+ Addedcsv-generate@4.4.1(transitive)
+ Addedcsv-parse@5.5.6(transitive)
+ Addedcsv-stringify@6.5.0(transitive)
+ Addedstream-transform@3.3.2(transitive)
- Removedcsv-generate@3.4.3(transitive)
- Removedcsv-parse@4.16.3(transitive)
- Removedcsv-stringify@5.6.5(transitive)
- Removedmixme@0.5.10(transitive)
- Removedstream-transform@2.1.3(transitive)
Updatedcsv-generate@^4.0.0
Updatedcsv-parse@^5.0.0
Updatedcsv-stringify@^6.0.0
Updatedstream-transform@^3.0.0