@nu-art/ts-common 0.203.77 → 0.203.79

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.77",
3
+ "version": "0.203.79",
4
4
  "description": "js and ts infra",
5
5
  "keywords": [
6
6
  "TacB0sS",
package/utils/types.d.ts CHANGED
@@ -120,7 +120,7 @@ export type Draftable = {
120
120
  /**
121
121
  * call function 'resolveContent(resolvableContentObject)' to receive the content which is T.
122
122
  */
123
- export type ResolvableContent<T, K extends any[] = never> = T | ((...param: K) => T);
123
+ export type ResolvableContent<T, K extends any[] = any[]> = T | ((...param: K) => T);
124
124
  export type Auditable = {
125
125
  _audit?: AuditBy;
126
126
  };