| 139 | callback: ReadCallback |
| 140 | ): number; |
| 141 | function read( |
| 142 | input: string, |
| 143 | sep: Comma | ReadCallback, |
| 144 | quo?: Quote | ReadCallback, |
| 145 | callback?: ReadCallback |
| 146 | ): number { |
| 147 | if (callback === undefined) { |
| 148 | if (quo === undefined) { |
| 149 | // arguments.length < 3) { |
| 150 | if (typeof sep !== 'function') { |
| 151 | throw Error('Last/second argument is not a callback'); |
| 152 | } |
| 153 | callback = sep; |
| 154 | sep = ','; |
| 155 | } else { |
| 156 | // arguments.length < 4) { |
| 157 | if (typeof quo !== 'function') { |
| 158 | throw Error('Last/third argument is not a callback'); |
| 159 | } |
| 160 | callback = quo; |
| 161 | quo = '"'; |
| 162 | } |
| 163 | } |
| 164 | const csv = new Parser(input, sep as Comma, quo as Quote); |
| 165 | const fields = csv.Row(); |
| 166 | callback(fields); |
| 167 | return csv.pointer; |
| 168 | } |
| 169 | |
| 170 | function forEach(input: string, callback: ForEachCallback): void; |
| 171 | function forEach(input: string, sep: Comma, callback: ForEachCallback): void; |