@nu-art/ts-common 0.203.78 → 0.203.80

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.
@@ -13,5 +13,6 @@ export declare class CSVModuleV3_Class extends Module {
13
13
  protected writeImpl: <I extends unknown>(writable: Writable, items: I[], options?: csv.FormatterOptionsArgs<any, any>) => Promise<void>;
14
14
  provideFormatter: (transformer?: (item: any) => any) => csv.CsvFormatterStream<csv.FormatterRow, csv.FormatterRow>;
15
15
  provideFormatterFromCsv: (transformer?: (item: any) => any) => csv.CsvParserStream<csv.ParserRow<any>, csv.ParserRow<any>>;
16
+ fromString: (str: string) => Promise<any[]>;
16
17
  }
17
18
  export declare const CSVModuleV3: CSVModuleV3_Class;
@@ -69,6 +69,24 @@ class CSVModuleV3_Class extends module_1.Module {
69
69
  return csv.parse({ headers: true, trim: true })
70
70
  .transform(transformer);
71
71
  };
72
+ this.fromString = (str) => __awaiter(this, void 0, void 0, function* () {
73
+ return new Promise((resolve, reject) => {
74
+ const data = [];
75
+ csv.parseString(str, { headers: true })
76
+ .on('data', row => {
77
+ console.log('HERE - data');
78
+ data.push(row);
79
+ })
80
+ .on('end', () => {
81
+ console.log('HERE - end');
82
+ resolve(data);
83
+ })
84
+ .on('error', err => {
85
+ console.log('HERE - err');
86
+ reject(err);
87
+ });
88
+ });
89
+ });
72
90
  }
73
91
  init() {
74
92
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nu-art/ts-common",
3
- "version": "0.203.78",
3
+ "version": "0.203.80",
4
4
  "description": "js and ts infra",
5
5
  "keywords": [
6
6
  "TacB0sS",