(lines: string[])
| 118 | |
| 119 | } |
| 120 | private processDataWithHead(lines: string[]): ProcessLineResult[] { |
| 121 | if (this.params.noheader) { |
| 122 | if (this.params.headers) { |
| 123 | this.runtime.headers = this.params.headers; |
| 124 | } else { |
| 125 | this.runtime.headers = []; |
| 126 | } |
| 127 | } else { |
| 128 | let left = ""; |
| 129 | let headerRow: string[] = []; |
| 130 | while (lines.length) { |
| 131 | const line = left + lines.shift(); |
| 132 | const row = this.rowSplit.parse(line); |
| 133 | if (row.closed) { |
| 134 | headerRow = row.cells; |
| 135 | left = ""; |
| 136 | break; |
| 137 | } else { |
| 138 | left = line + getEol(line, this.runtime); |
| 139 | } |
| 140 | } |
| 141 | this.prependLeftBuf(bufFromString(left)); |
| 142 | |
| 143 | if (headerRow.length === 0) { |
| 144 | return []; |
| 145 | } |
| 146 | if (this.params.headers) { |
| 147 | this.runtime.headers = this.params.headers; |
| 148 | } else { |
| 149 | this.runtime.headers = headerRow; |
| 150 | } |
| 151 | } |
| 152 | if (this.runtime.needProcessIgnoreColumn || this.runtime.needProcessIncludeColumn) { |
| 153 | this.filterHeader(); |
| 154 | } |
| 155 | if (this.needEmitHead && !this.headEmitted) { |
| 156 | this.converter.emit("header", this.runtime.headers); |
| 157 | this.headEmitted = true; |
| 158 | } |
| 159 | return this.processCSVBody(lines); |
| 160 | } |
| 161 | private filterHeader() { |
| 162 | this.runtime.selectedColumns = []; |
| 163 | if (this.runtime.headers) { |
no test coverage detected