@punks/backend-core 0.0.17 → 0.0.18
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 +12 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/utils/csv.d.ts +1 -1
- package/dist/esm/index.js +12 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/utils/csv.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -210,7 +210,18 @@ const iterate = (values, action) => {
|
|
|
210
210
|
};
|
|
211
211
|
|
|
212
212
|
const DEFAULT_DELIMITER = ";";
|
|
213
|
-
const
|
|
213
|
+
const splitRows = async (data) => {
|
|
214
|
+
if (typeof data === "string") {
|
|
215
|
+
return data.split("\n");
|
|
216
|
+
}
|
|
217
|
+
if (data instanceof Blob) {
|
|
218
|
+
const text = await data.text();
|
|
219
|
+
return await splitRows(text);
|
|
220
|
+
}
|
|
221
|
+
return data;
|
|
222
|
+
};
|
|
223
|
+
const csvParseRaw = async (data, separator) => {
|
|
224
|
+
const rows = await splitRows(data);
|
|
214
225
|
const records = [];
|
|
215
226
|
for (const row of rows) {
|
|
216
227
|
const record = row.split(separator);
|