@naturalcycles/nodejs-lib 12.80.3 → 12.80.4

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,10 +1,10 @@
1
1
  export interface IDebug {
2
2
  (namespace: string): IDebugger;
3
- coerce: (val: any) => any;
4
- disable: () => string;
5
- enable: (namespaces: string) => void;
6
- enabled: (namespaces: string) => boolean;
7
- log: (...args: any[]) => any;
3
+ coerce(val: any): any;
4
+ disable(): string;
5
+ enable(namespaces: string): void;
6
+ enabled(namespaces: string): boolean;
7
+ log(...args: any[]): any;
8
8
  names: RegExp[];
9
9
  skips: RegExp[];
10
10
  formatters: DebugFormatters;
@@ -16,8 +16,8 @@ export interface IDebugger {
16
16
  (...args: any[]): void;
17
17
  color: string;
18
18
  enabled: boolean;
19
- log: (...args: any[]) => any;
19
+ log(...args: any[]): any;
20
20
  namespace: string;
21
- destroy: () => boolean;
21
+ destroy(): boolean;
22
22
  }
23
23
  export declare const Debug: IDebug;
@@ -75,7 +75,7 @@ export interface TransformLogProgressOptions<IN = any> extends TransformOptions
75
75
  *
76
76
  * chunk is undefined for "final" stats, otherwise is defined.
77
77
  */
78
- extra?: (chunk: IN | undefined, index: number) => AnyObject;
78
+ extra?(chunk: IN | undefined, index: number): AnyObject;
79
79
  /**
80
80
  * If specified - will multiply the counter by this number.
81
81
  * Useful e.g when using `transformBuffer({ batchSize: 500 })`, so
@@ -29,7 +29,7 @@ export interface TransformMapOptions<IN = any, OUT = IN> {
29
29
  * If defined - will be called on every error happening in the stream.
30
30
  * Called BEFORE observable will emit error (unless skipErrors is set to true).
31
31
  */
32
- onError?: (err: Error, input: IN) => any;
32
+ onError?(err: Error, input: IN): any;
33
33
  /**
34
34
  * Progress metric
35
35
  *
@@ -27,7 +27,7 @@ export interface TransformMapSyncOptions<IN = any, OUT = IN> {
27
27
  * If defined - will be called on every error happening in the stream.
28
28
  * Called BEFORE observable will emit error (unless skipErrors is set to true).
29
29
  */
30
- onError?: (err: Error, input: IN) => any;
30
+ onError?(err: Error, input: IN): any;
31
31
  /**
32
32
  * Progress metric
33
33
  *
@@ -106,7 +106,7 @@ function createError(value, err, objectName) {
106
106
  const tokens = [];
107
107
  const objectId = (0, js_lib_1._isObject)(value) ? value['id'] : undefined;
108
108
  if (objectId || objectName) {
109
- objectName = objectName || value?.constructor?.name;
109
+ objectName ||= value?.constructor?.name;
110
110
  tokens.push('Invalid ' + [objectName, objectId].filter(Boolean).join('.'));
111
111
  }
112
112
  const annotation = err.annotate(stripColors);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/nodejs-lib",
3
- "version": "12.80.3",
3
+ "version": "12.80.4",
4
4
  "scripts": {
5
5
  "prepare": "husky install",
6
6
  "docs-serve": "vuepress dev docs",
package/src/log/debug.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  // Types based on @types/debug
2
2
  export interface IDebug {
3
3
  (namespace: string): IDebugger
4
- coerce: (val: any) => any
5
- disable: () => string
6
- enable: (namespaces: string) => void
7
- enabled: (namespaces: string) => boolean
8
- log: (...args: any[]) => any
4
+ coerce(val: any): any
5
+ disable(): string
6
+ enable(namespaces: string): void
7
+ enabled(namespaces: string): boolean
8
+ log(...args: any[]): any
9
9
 
10
10
  names: RegExp[]
11
11
  skips: RegExp[]
@@ -23,9 +23,9 @@ export interface IDebugger {
23
23
 
24
24
  color: string
25
25
  enabled: boolean
26
- log: (...args: any[]) => any
26
+ log(...args: any[]): any
27
27
  namespace: string
28
- destroy: () => boolean
28
+ destroy(): boolean
29
29
  // extend: (namespace: string, delimiter?: string) => IDebugger
30
30
  }
31
31
 
@@ -100,7 +100,7 @@ export interface TransformLogProgressOptions<IN = any> extends TransformOptions
100
100
  *
101
101
  * chunk is undefined for "final" stats, otherwise is defined.
102
102
  */
103
- extra?: (chunk: IN | undefined, index: number) => AnyObject
103
+ extra?(chunk: IN | undefined, index: number): AnyObject
104
104
 
105
105
  /**
106
106
  * If specified - will multiply the counter by this number.
@@ -48,7 +48,7 @@ export interface TransformMapOptions<IN = any, OUT = IN> {
48
48
  * If defined - will be called on every error happening in the stream.
49
49
  * Called BEFORE observable will emit error (unless skipErrors is set to true).
50
50
  */
51
- onError?: (err: Error, input: IN) => any
51
+ onError?(err: Error, input: IN): any
52
52
 
53
53
  /**
54
54
  * Progress metric
@@ -43,7 +43,7 @@ export interface TransformMapSyncOptions<IN = any, OUT = IN> {
43
43
  * If defined - will be called on every error happening in the stream.
44
44
  * Called BEFORE observable will emit error (unless skipErrors is set to true).
45
45
  */
46
- onError?: (err: Error, input: IN) => any
46
+ onError?(err: Error, input: IN): any
47
47
 
48
48
  /**
49
49
  * Progress metric
@@ -139,7 +139,7 @@ function createError(value: any, err: ValidationError, objectName?: string): Joi
139
139
  const objectId = _isObject(value) ? (value['id'] as string) : undefined
140
140
 
141
141
  if (objectId || objectName) {
142
- objectName = objectName || value?.constructor?.name
142
+ objectName ||= value?.constructor?.name
143
143
 
144
144
  tokens.push('Invalid ' + [objectName, objectId].filter(Boolean).join('.'))
145
145
  }