better-console-group 1.1.5 → 1.1.6

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.
Binary file
package/.yarnrc.yml ADDED
@@ -0,0 +1 @@
1
+ nodeLinker: node-modules
package/README.md CHANGED
@@ -134,7 +134,7 @@ for (let imageURL in imageURLs) {
134
134
  });
135
135
  }
136
136
 
137
- group.log('Finish processing image.');=
137
+ group.log('Finish processing image.');
138
138
  });
139
139
  processingPromises.push(processingPromise);
140
140
  }
package/index.js.flow CHANGED
@@ -1,5 +1,30 @@
1
+ declare class AsyncConsoleGroup {
2
+ asyncGroup<T>(
3
+ label: string,
4
+ callbackFn: (group: AsyncConsoleGroup) => Promise<T>,
5
+ thisArg?: any,
6
+ ): Promise<T>;
7
+ log(message?: any, ...optionalParams: any[]): void;
8
+ warn(message?: any, ...optionalParams: any[]): void;
9
+ error(message?: any, ...optionalParams: any[]): void;
10
+ debug(message?: any, ...optionalParams: any[]): void;
11
+ info(message?: any, ...optionalParams: any[]): void;
12
+ table(tabularData?: any, properties?: Array<string>): void;
13
+ trace(...data: any[]): void;
14
+ assert(condition?: boolean, message?: string, ...optionalParams: any[]): void;
15
+ time(label?: string): void;
16
+ timeEnd(label?: string): void;
17
+ dir(item?: any, options?: { ... }): void;
18
+ }
19
+
1
20
  declare export function betterGroup<T>(
2
21
  label: string,
3
22
  callbackFn: () => T,
4
23
  thisArg?: any,
5
24
  ): T;
25
+
26
+ declare export function asyncGroup<T>(
27
+ label: string,
28
+ callbackFn: (group: AsyncConsoleGroup) => Promise<T>,
29
+ thisArg?: any,
30
+ ): Promise<T>;
package/lib/asyncGroup.js CHANGED
@@ -150,70 +150,17 @@ export async function asyncGroup(label, callbackFn, thisArg) {
150
150
  const buffer = group.end();
151
151
  console.group(label);
152
152
  while (buffer.length > 0) {
153
- const [...methodAndParams] = buffer.shift();
153
+ const methodAndParams = buffer.shift();
154
154
  switch (methodAndParams[0]) {
155
- case 'group': {
156
- const [, nestedLabel] = methodAndParams;
157
- console.group(nestedLabel);
155
+ case 'group':
156
+ console.group(methodAndParams[1]);
158
157
  break;
159
- }
160
158
  case 'groupEnd':
161
159
  console.groupEnd();
162
160
  break;
163
- case 'log': {
164
- const [, ...params] = methodAndParams;
165
- console.log(...params); // eslint-disable-line @typescript-eslint/no-unsafe-argument
166
- break;
167
- }
168
- case 'warn': {
169
- const [, ...params] = methodAndParams;
170
- console.warn(...params); // eslint-disable-line @typescript-eslint/no-unsafe-argument
171
- break;
172
- }
173
- case 'error': {
174
- const [, ...params] = methodAndParams;
175
- console.error(...params); // eslint-disable-line @typescript-eslint/no-unsafe-argument
176
- break;
177
- }
178
- case 'debug': {
179
- const [, ...params] = methodAndParams;
180
- console.debug(...params); // eslint-disable-line @typescript-eslint/no-unsafe-argument
181
- break;
182
- }
183
- case 'info': {
184
- const [, ...params] = methodAndParams;
185
- console.info(...params); // eslint-disable-line @typescript-eslint/no-unsafe-argument
186
- break;
187
- }
188
- case 'table': {
189
- const [, ...params] = methodAndParams;
190
- console.table(...params);
191
- break;
192
- }
193
- case 'trace': {
194
- const [, ...params] = methodAndParams;
195
- console.trace(...params); // eslint-disable-line @typescript-eslint/no-unsafe-argument
196
- break;
197
- }
198
- case 'assert': {
199
- const [, ...params] = methodAndParams;
200
- console.assert(...params);
201
- break;
202
- }
203
- case 'time': {
204
- const [, ...params] = methodAndParams;
205
- console.time(...params);
206
- break;
207
- }
208
- case 'timeEnd': {
209
- const [, ...params] = methodAndParams;
210
- console.timeEnd(...params);
211
- break;
212
- }
213
- case 'dir': {
214
- const [, ...params] = methodAndParams;
215
- console.dir(...params);
216
- break;
161
+ default: {
162
+ const [method, ...params] = methodAndParams;
163
+ console[method](...params);
217
164
  }
218
165
  }
219
166
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-console-group",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "Better API for console.group.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -51,9 +51,8 @@
51
51
  "codecov": "^3.6.1",
52
52
  "eslint": "^10.0.0",
53
53
  "eslint-config-prettier": "^10.0.1",
54
- "eslint-plugin-flowtype": "^8.0.2",
55
54
  "eslint-plugin-prettier": "^5.2.1",
56
- "flow-bin": "^0.307.0",
55
+ "flow-bin": "^0.309.0",
57
56
  "is-ci": "^4.1.0",
58
57
  "jest": "^30.0.0",
59
58
  "json": "^11.0.0",
@@ -73,5 +72,5 @@
73
72
  ],
74
73
  "*.{json,yml,yaml,md,markdown}": "yarn format"
75
74
  },
76
- "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
75
+ "packageManager": "yarn@4.13.0"
77
76
  }