@@ -30,12 +30,13 @@ $ npm install @mrodrig/json-2-csv-cli
30
30
31
31
## Upgrading?
32
32
33
- Upgrading to v3 from v2 ? Check out the [ upgrade guide] ( https://github.com/mrodrig/json-2-csv/blob/master/upgrade_guides/UPGRADE_2_to_3 .md ) .
33
+ Upgrading to v4 from v3 ? Check out the [ upgrade guide] ( https://github.com/mrodrig/json-2-csv/blob/master/upgrade_guides/UPGRADE_3_to_4 .md ) .
34
34
35
35
## Usage
36
36
37
37
``` javascript
38
38
let converter = require (' json-2-csv' );
39
+ const csv = await converter .json2csv (data, options);
39
40
```
40
41
or
41
42
``` javascript
@@ -45,11 +46,9 @@ Looking for examples? Check out the Wiki: [json-2-csv Wiki](https://github.com/m
45
46
46
47
### API
47
48
48
- #### ` converter. json2csv(array, callback , options)`
49
+ #### ` json2csv(array, options) `
49
50
50
51
* ` array ` - An array of JSON documents to be converted to CSV.
51
- * ` callback ` - A function of the form ` function (err, csv) ` ;
52
- * This function will receive any errors and/or the string of CSV generated.
53
52
* ` options ` - (Optional) A JSON document specifying any of the following key value pairs:
54
53
* ` checkSchemaDifferences ` - Boolean - Should all documents have the same schema?
55
54
* Default: ` false `
@@ -146,14 +145,9 @@ Looking for examples? Check out the Wiki: [json-2-csv Wiki](https://github.com/m
146
145
147
146
For examples, please refer to the [json2csv API Documentation (Link)](https://github.com/mrodrig/json-2-csv/wiki/json2csv-Documentation)
148
147
149
- #### Promisified Version: `converter.json2csvAsync(array, options)`
150
-
151
- Available in version `2.2.0`, this functionality makes use of promises from the `bluebird` module.
152
-
153
- #### `converter.csv2json(csv, callback, options)`
148
+ #### `csv2json(csv, options)`
154
149
155
150
* `csv` - A string of CSV
156
- * `callback` - A function of the form `function (err, array)`; This function will receive any errors and/or the array of JSON documents generated.
157
151
* `options` - (Optional) A JSON document specifying any of the following key value pairs:
158
152
* `delimiter` - Document - Specifies the different types of delimiters
159
153
* `field` - String - Field Delimiter.
@@ -181,10 +175,6 @@ Available in version `2.2.0`, this functionality makes use of promises from the
181
175
182
176
For examples, please refer to the [csv2json API Documentation (Link)](https://github.com/mrodrig/json-2-csv/wiki/csv2json-Documentation)
183
177
184
- #### Promisified Version: `csv2jsonAsync(csv, options)`
185
-
186
- Available in version `2.2.0`, this functionality makes use of promises from the `bluebird` module.
187
-
188
178
### CLI
189
179
Note: As of `3.5.8`, the command line interface functionality has been pulled out to a separate package. Please be sure to
190
180
install the `@mrodrig/json-2-csv-cli` NPM package if you wish to use the CLI functionality shown below:
@@ -244,14 +234,6 @@ To see test coverage, please run:
244
234
$ npm run coverage
245
235
```
246
236
247
- Current Coverage is:
248
- ```
249
- Statements : 100% ( 286/286 )
250
- Branches : 100% ( 166/166 )
251
- Functions : 100% ( 73/73 )
252
- Lines : 100% ( 280/280 )
253
- ```
254
-
255
237
## Frequently Asked Questions (FAQ)
256
238
Please find the updated list (relocated to the Wiki) here: [ Frequently Asked Questions (Link)] ( https://github.com/mrodrig/json-2-csv/wiki/FAQ )
257
239
0 commit comments