@punks/backend-core 0.0.18 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js
CHANGED
|
@@ -210,18 +210,18 @@ const iterate = (values, action) => {
|
|
|
210
210
|
};
|
|
211
211
|
|
|
212
212
|
const DEFAULT_DELIMITER = ";";
|
|
213
|
-
const splitRows =
|
|
213
|
+
const splitRows = (data) => {
|
|
214
214
|
if (typeof data === "string") {
|
|
215
215
|
return data.split("\n");
|
|
216
216
|
}
|
|
217
|
-
if (data instanceof
|
|
218
|
-
const text =
|
|
219
|
-
return
|
|
217
|
+
if (data instanceof Buffer) {
|
|
218
|
+
const text = data.toString("utf-8");
|
|
219
|
+
return splitRows(text);
|
|
220
220
|
}
|
|
221
221
|
return data;
|
|
222
222
|
};
|
|
223
|
-
const csvParseRaw =
|
|
224
|
-
const rows =
|
|
223
|
+
const csvParseRaw = (data, separator) => {
|
|
224
|
+
const rows = splitRows(data);
|
|
225
225
|
const records = [];
|
|
226
226
|
for (const row of rows) {
|
|
227
227
|
const record = row.split(separator);
|