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

Method processResult

src/Result.ts:22–52  ·  view source on GitHub ↗
(resultLines: ProcessLineResult[])

Source from the content-addressed store, hash-verified

20 private finalResult: any[] = [];
21 constructor(private converter: Converter) { }
22 processResult(resultLines: ProcessLineResult[]): Promise<any> {
23 const startPos = this.converter.parseRuntime.parsedLineNumber;
24 if (this.needPushDownstream && this.converter.parseParam.downstreamFormat === "array") {
25 if (startPos === 0) {
26 pushDownstream(this.converter, "[" + EOL);
27 }
28 }
29 // let prom: Promise<any>;
30 return new Promise((resolve, reject) => {
31 if (this.needEmitLine) {
32 processLineByLine(
33 resultLines,
34 this.converter,
35 0,
36 this.needPushDownstream,
37 (err) => {
38 if (err) {
39 reject(err);
40 } else {
41 this.appendFinalResult(resultLines);
42 resolve(undefined);
43 }
44 },
45 )
46 // resolve();
47 } else {
48 this.appendFinalResult(resultLines);
49 resolve(undefined);
50 }
51 })
52 }
53 appendFinalResult(lines: any[]) {
54 if (this.needEmitAll) {
55 this.finalResult = this.finalResult.concat(lines);

Callers 6

browser.jsFile · 0.80
csvtojson.min.jsFile · 0.80
Converter.jsFile · 0.80
_transformMethod · 0.80
_flushMethod · 0.80
Converter.jsFile · 0.80

Calls 3

appendFinalResultMethod · 0.95
pushDownstreamFunction · 0.70
processLineByLineFunction · 0.70

Tested by

no test coverage detected