@@ -20,7 +20,7 @@ var flatten = require('flat');
20
20
* @property {String } [defaultValue="<empty>"] - default value to use when missing data
21
21
* @property {String } [quotes='"'] - quotes around cell values and column names
22
22
* @property {String } [doubleQuotes='""'] - the value to replace double quotes in strings
23
- * @property {Boolean } [hasCSVColumnTitle =true] - determines whether or not CSV file will contain a title column
23
+ * @property {Boolean } [noHeader =true] - determines whether or not CSV file will contain a title column
24
24
* @property {String } [eol=''] - it gets added to each row of data
25
25
* @property {String } [newLine] - overrides the default OS line ending (\n on Unix \r\n on Windows)
26
26
* @property {Boolean } [flatten=false] - flattens nested JSON using flat (https://www.npmjs.com/package/flat)
@@ -34,7 +34,7 @@ var flatten = require('flat');
34
34
* Main function that converts json to csv.
35
35
*
36
36
* @param {Json2CsvParams } params Function parameters containing data, fields,
37
- * delimiter (default is ','), hasCSVColumnTitle (default is true)
37
+ * delimiter (default is ','), noHeader (default is true)
38
38
* and default value (default is '')
39
39
* @param {Function } [callback] Callback function
40
40
* if error, returning error in call back.
@@ -75,7 +75,7 @@ module.exports = function (params, callback) {
75
75
* Note that this modifies params.
76
76
*
77
77
* @param {Json2CsvParams } params Function parameters containing data, fields,
78
- * delimiter, default value, mark quotes and hasCSVColumnTitle
78
+ * delimiter, default value, mark quotes and noHeader
79
79
*/
80
80
function checkParams ( params ) {
81
81
params . data = params . data || [ ] ;
@@ -133,8 +133,8 @@ function checkParams(params) {
133
133
//#check default value
134
134
params . defaultValue = params . defaultValue ;
135
135
136
- //#check hasCSVColumnTitle , if it is not explicitly set to false then true.
137
- params . hasCSVColumnTitle = params . hasCSVColumnTitle !== false ;
136
+ //#check noHeader , if it is not explicitly set to false then true.
137
+ params . noHeader = params . noHeader !== false ;
138
138
139
139
//#check include empty rows, defaults to false
140
140
params . includeEmptyRows = params . includeEmptyRows || false ;
@@ -161,7 +161,7 @@ function createColumnTitles(params) {
161
161
var str = '' ;
162
162
163
163
//if CSV has column title, then create it
164
- if ( params . hasCSVColumnTitle ) {
164
+ if ( params . noHeader ) {
165
165
params . fieldNames . forEach ( function ( element ) {
166
166
if ( str !== '' ) {
167
167
str += params . del ;
0 commit comments