You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -9,19 +8,19 @@ The [`csv-generate` package](https://csv.js.org/generate/) provides a flexible g
* Multiple types of values (integer, boolean, dates, ...)
24
-
* MIT License
18
+
- Scalable `stream.Readable` implementation
19
+
- random or pseudo-random seed based generation
20
+
- Idempotence with the "seed" option
21
+
- User-defined value generation
22
+
- Multiple types of values (integer, boolean, dates, ...)
23
+
- MIT License
25
24
26
25
## Usage
27
26
@@ -34,39 +33,40 @@ Use the callback and sync APIs for simplicity or the stream based API for scalab
34
33
The [API](https://csv.js.org/generate/api/) is available in multiple flavors. This example illustrates the stream API.
35
34
36
35
```js
37
-
import { generate } from'csv-generate';
38
-
importassertfrom'assert';
36
+
import { generate } from"csv-generate";
37
+
importassertfrom"assert";
39
38
40
39
constrecords= [];
41
40
// Initialize the generator
42
41
generate({
43
42
seed:1,
44
43
objectMode:true,
45
44
columns:2,
46
-
length:2
45
+
length:2,
47
46
})
48
47
// Use the readable stream api to consume generated records
49
-
.on('readable', function(){
50
-
let record; while((record =this.read()) !==null){
48
+
.on("readable", function () {
49
+
let record;
50
+
while ((record =this.read()) !==null) {
51
51
records.push(record);
52
52
}
53
53
})
54
54
// Catch any error
55
-
.on('error', function(err){
55
+
.on("error", function(err){
56
56
console.error(err);
57
57
})
58
58
// Test that the generated records matched the expected records
59
-
.on('end', function(){
59
+
.on("end", function () {
60
60
assert.deepEqual(records, [
61
-
['OMH', 'ONKCHhJmjadoA'],
62
-
['D', 'GeACHiN' ]
61
+
["OMH", "ONKCHhJmjadoA"],
62
+
["D", "GeACHiN"],
63
63
]);
64
64
});
65
65
```
66
66
67
67
## Development
68
68
69
-
Tests are executed with [Mocha](https://mochajs.org/). To install it, simple run `npm install` followed by `npm test`. It will install mocha and its dependencies in your project "node_modules" directory and run the test suite. The tests run against the CoffeeScript source files.
69
+
Tests are executed with [Mocha](https://mochajs.org/). To install it, simple run `npm install` followed by `npm test`. It will install mocha and its dependencies in your project "node_modules" directory and run the test suite. The tests run against the CoffeeScript source files.
70
70
71
71
To generate the JavaScript files, run `npm run coffee`.
72
72
@@ -76,4 +76,4 @@ The test suite is run online with [Travis](https://travis-ci.org/#!/adaltas/node
76
76
77
77
The project is sponsored by [Adaltas](https://www.adaltas.com), an Big Data consulting firm based in Paris, France.
78
78
79
-
* David Worms: <https://github.com/wdavidw>
79
+
- David Worms: <https://github.com/wdavidw>
The [`csv-parse` package](https://csv.js.org/parse/) is a parser converting CSV text input into arrays or objects. It is part of the [CSV project](https://csv.js.org/).
9
8
10
9
It implements the Node.js [`stream.Transform` API](http://nodejs.org/api/stream.html#stream_class_stream_transform). It also provides a simple callback-based API for convenience. It is both extremely easy to use and powerful. It was first released in 2010 and is used against big data sets by a large community.
* Flexible with lot of [options](https://csv.js.org/parse/options/)
24
-
* Multiple [distributions](https://csv.js.org/parse/distributions/): Node.js, Web, ECMAScript modules and CommonJS
25
-
* Follow the Node.js streaming API
26
-
* Simplicity with the optional callback API
27
-
* Support delimiters, quotes, escape characters and comments
28
-
* Line breaks discovery
29
-
* Support big datasets
30
-
* Complete test coverage and lot of samples for inspiration
31
-
* No external dependencies
32
-
* Work nicely with the [csv-generate](https://csv.js.org/generate/), [stream-transform](https://csv.js.org/transform/) and [csv-stringify](https://csv.js.org/stringify/) packages
33
-
* MIT License
22
+
- Flexible with lot of [options](https://csv.js.org/parse/options/)
23
+
- Multiple [distributions](https://csv.js.org/parse/distributions/): Node.js, Web, ECMAScript modules and CommonJS
24
+
- Follow the Node.js streaming API
25
+
- Simplicity with the optional callback API
26
+
- Support delimiters, quotes, escape characters and comments
27
+
- Line breaks discovery
28
+
- Support big datasets
29
+
- Complete test coverage and lot of samples for inspiration
30
+
- No external dependencies
31
+
- Work nicely with the [csv-generate](https://csv.js.org/generate/), [stream-transform](https://csv.js.org/transform/) and [csv-stringify](https://csv.js.org/stringify/) packages
32
+
- MIT License
34
33
35
34
## Usage
36
35
@@ -43,34 +42,31 @@ Use the callback and sync APIs for simplicity or the stream based API for scalab
43
42
The [API](https://csv.js.org/parse/api/) is available in multiple flavors. This example illustrates the stream API.
44
43
45
44
```js
46
-
importassertfrom'assert';
47
-
import { parse } from'csv-parse';
45
+
importassertfrom"assert";
46
+
import { parse } from"csv-parse";
48
47
49
48
constrecords= [];
50
49
// Initialize the parser
51
50
constparser=parse({
52
-
delimiter:':'
51
+
delimiter:":",
53
52
});
54
53
// Use the readable stream api to consume records
55
-
parser.on('readable', function(){
54
+
parser.on("readable", function () {
56
55
let record;
57
56
while ((record =parser.read()) !==null) {
58
57
records.push(record);
59
58
}
60
59
});
61
60
// Catch any error
62
-
parser.on('error', function(err){
61
+
parser.on("error", function(err){
63
62
console.error(err.message);
64
63
});
65
64
// Test that the parsed records matched the expected records
The project is sponsored by [Adaltas](https://www.adaltas.com), an Big Data consulting firm based in Paris, France.
85
81
86
-
* David Worms: <https://github.com/wdavidw>
82
+
- David Worms: <https://github.com/wdavidw>
@@ -9,21 +8,21 @@ The [`csv-stringify` package](https://csv.js.org/stringify/) is a stringifier co
* Support for custom formatters, delimiters, quotes, escape characters and header
22
-
* Support big datasets
23
-
* Complete test coverage and samples for inspiration
24
-
* Only 1 external dependency
25
-
* to be used conjointly with `csv-generate`, `csv-parse` and `stream-transform`
26
-
* MIT License
18
+
- Follow the Node.js streaming API
19
+
- Simplicity with the optional callback API
20
+
- Support for custom formatters, delimiters, quotes, escape characters and header
21
+
- Support big datasets
22
+
- Complete test coverage and samples for inspiration
23
+
- Only 1 external dependency
24
+
- to be used conjointly with `csv-generate`, `csv-parse` and `stream-transform`
25
+
- MIT License
27
26
28
27
## Usage
29
28
@@ -36,15 +35,15 @@ The module is built on the Node.js Stream API. Use the callback and sync APIs fo
36
35
The [API](https://csv.js.org/stringify/api/) is available in multiple flavors. This example illustrates the sync API.
37
36
38
37
```js
39
-
import { stringify } from'csv-stringify/sync';
40
-
importassertfrom'assert';
38
+
import { stringify } from"csv-stringify/sync";
39
+
importassertfrom"assert";
41
40
42
41
constoutput=stringify([
43
-
['1', '2', '3', '4'],
44
-
['a', 'b', 'c', 'd' ]
42
+
["1", "2", "3", "4"],
43
+
["a", "b", "c", "d"],
45
44
]);
46
45
47
-
assert.equal(output, '1,2,3,4\na,b,c,d\n');
46
+
assert.equal(output, "1,2,3,4\na,b,c,d\n");
48
47
```
49
48
50
49
## Development
@@ -59,4 +58,4 @@ The test suite is run online with [Travis](https://travis-ci.org/#!/adaltas/node
59
58
60
59
The project is sponsored by [Adaltas](https://www.adaltas.com), an Big Data consulting firm based in Paris, France.
61
60
62
-
* David Worms: <https://github.com/wdavidw>
61
+
- David Worms: <https://github.com/wdavidw>
0 commit comments