@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.
@@ -1,4 +1,5 @@
1
- export declare const csvParseRaw: (data: string | string[] | Blob, separator: string) => Promise<string[][]>;
1
+ /// <reference types="node" />
2
+ export declare const csvParseRaw: (data: string | string[] | Buffer, separator: string) => string[][];
2
3
  export interface CsvColumnDefinition<T> {
3
4
  name: string;
4
5
  value: (item: T) => any;
package/dist/esm/index.js CHANGED
@@ -201,18 +201,18 @@ const iterate = (values, action) => {
201
201
  };
202
202
 
203
203
  const DEFAULT_DELIMITER = ";";
204
- const splitRows = async (data) => {
204
+ const splitRows = (data) => {
205
205
  if (typeof data === "string") {
206
206
  return data.split("\n");
207
207
  }
208
- if (data instanceof Blob) {
209
- const text = await data.text();
210
- return await splitRows(text);
208
+ if (data instanceof Buffer) {
209
+ const text = data.toString("utf-8");
210
+ return splitRows(text);
211
211
  }
212
212
  return data;
213
213
  };
214
- const csvParseRaw = async (data, separator) => {
215
- const rows = await splitRows(data);
214
+ const csvParseRaw = (data, separator) => {
215
+ const rows = splitRows(data);
216
216
  const records = [];
217
217
  for (const row of rows) {
218
218
  const record = row.split(separator);