MCPcopy Create free account
hub / github.com/Inist-CNRS/node-csv-string / read

Function read

src/CSV.ts:141–168  ·  view source on GitHub ↗
(
  input: string,
  sep: Comma | ReadCallback,
  quo?: Quote | ReadCallback,
  callback?: ReadCallback
)

Source from the content-addressed store, hash-verified

139 callback: ReadCallback
140): number;
141function 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
170function forEach(input: string, callback: ForEachCallback): void;
171function forEach(input: string, sep: Comma, callback: ForEachCallback): void;

Callers 2

forEachFunction · 0.85
fetchFunction · 0.85

Calls 1

RowMethod · 0.95

Tested by

no test coverage detected