(params?: Partial<CSVParseParam>)
| 96 | } |
| 97 | |
| 98 | export function mergeParams(params?: Partial<CSVParseParam>): CSVParseParam { |
| 99 | const defaultParam: CSVParseParam = { |
| 100 | delimiter: ',', |
| 101 | ignoreColumns: undefined, |
| 102 | includeColumns: undefined, |
| 103 | quote: '"', |
| 104 | trim: true, |
| 105 | checkType: false, |
| 106 | ignoreEmpty: false, |
| 107 | // fork: false, |
| 108 | noheader: false, |
| 109 | headers: undefined, |
| 110 | flatKeys: false, |
| 111 | maxRowLength: 0, |
| 112 | checkColumn: false, |
| 113 | escape: '"', |
| 114 | colParser: {}, |
| 115 | eol: undefined, |
| 116 | alwaysSplitAtEOL: false, |
| 117 | output: "json", |
| 118 | nullObject: false, |
| 119 | downstreamFormat:"line", |
| 120 | needEmitAll:true |
| 121 | } |
| 122 | if (!params) { |
| 123 | params = {}; |
| 124 | } |
| 125 | for (let key in params) { |
| 126 | if (params.hasOwnProperty(key)) { |
| 127 | if (Array.isArray(params[key])) { |
| 128 | defaultParam[key] = [...params[key]]; |
| 129 | } else { |
| 130 | defaultParam[key] = params[key]; |
| 131 | } |
| 132 | } |
| 133 | } |
| 134 | return defaultParam; |
| 135 | } |
no outgoing calls
no test coverage detected