MCPcopy Create free account
hub / github.com/Keyang/node-csvtojson / mergeParams

Function mergeParams

src/Parameters.ts:98–135  ·  view source on GitHub ↗
(params?: Partial<CSVParseParam>)

Source from the content-addressed store, hash-verified

96}
97
98export 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}

Callers 2

prepareParamMethod · 0.90
constructorMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected