triangle-utils 1.4.108 → 1.4.110
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.
- package/dist/src/UtilsMisc.d.ts +1 -1
- package/dist/src/UtilsMisc.js +3 -2
- package/package.json +1 -1
- package/src/UtilsMisc.ts +3 -2
package/dist/src/UtilsMisc.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare class UtilsMisc {
|
|
|
7
7
|
readonly config: GlobalConfig;
|
|
8
8
|
constructor(config: GlobalConfig);
|
|
9
9
|
safe_run<T>(f: () => Promise<T>): Promise<T | undefined>;
|
|
10
|
-
iterate<T, U>(inputs: T[], f: (input: T, iterator_id: number, index: number) => Promise<U>,
|
|
10
|
+
iterate<T, U>(inputs: T[], f: (input: T, iterator_id: number, index: number) => Promise<U>, options?: {
|
|
11
11
|
num_iterators?: number;
|
|
12
12
|
verbosity?: number | boolean;
|
|
13
13
|
}): Promise<(U | undefined)[]>;
|
package/dist/src/UtilsMisc.js
CHANGED
|
@@ -21,7 +21,8 @@ export class UtilsMisc {
|
|
|
21
21
|
}
|
|
22
22
|
return undefined;
|
|
23
23
|
}
|
|
24
|
-
async iterate(inputs, f,
|
|
24
|
+
async iterate(inputs, f, options = {}) {
|
|
25
|
+
const num_iterators = options.num_iterators || 1;
|
|
25
26
|
const verbosity = typeof options.verbosity === "boolean" ? (options.verbosity === true ? 1 : 0) : (options.verbosity || 0);
|
|
26
27
|
let index = 0;
|
|
27
28
|
let iterators = [];
|
|
@@ -44,7 +45,7 @@ export class UtilsMisc {
|
|
|
44
45
|
}
|
|
45
46
|
async batch_iterate(inputs, f, options) {
|
|
46
47
|
const batch_size = options.batch_size || 1;
|
|
47
|
-
const num_iterators = options.num_iterators ||
|
|
48
|
+
const num_iterators = options.num_iterators || 1;
|
|
48
49
|
const verbosity = typeof options.verbosity === "boolean" ? (options.verbosity === true ? 1 : 0) : (options.verbosity || 0);
|
|
49
50
|
let index = 0;
|
|
50
51
|
let iterators = [];
|
package/package.json
CHANGED
package/src/UtilsMisc.ts
CHANGED
|
@@ -31,7 +31,8 @@ export class UtilsMisc {
|
|
|
31
31
|
return undefined
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
async iterate<T, U>(inputs : T[], f : (input : T, iterator_id : number, index : number) => Promise<U>,
|
|
34
|
+
async iterate<T, U>(inputs : T[], f : (input : T, iterator_id : number, index : number) => Promise<U>, options : { num_iterators? : number, verbosity? : number | boolean } = {}) {
|
|
35
|
+
const num_iterators = options.num_iterators || 1
|
|
35
36
|
const verbosity : number = typeof options.verbosity === "boolean" ? (options.verbosity === true ? 1 : 0) : (options.verbosity || 0)
|
|
36
37
|
let index = 0
|
|
37
38
|
let iterators = []
|
|
@@ -56,7 +57,7 @@ export class UtilsMisc {
|
|
|
56
57
|
async batch_iterate<T, U>(inputs : T[], f : (inputs : T[], iterator_id : number, index : number) => Promise<U>,
|
|
57
58
|
options : { batch_size? : number, num_iterators? : number, verbosity? : number | boolean }) {
|
|
58
59
|
const batch_size = options.batch_size || 1
|
|
59
|
-
const num_iterators = options.num_iterators ||
|
|
60
|
+
const num_iterators = options.num_iterators || 1
|
|
60
61
|
const verbosity : number = typeof options.verbosity === "boolean" ? (options.verbosity === true ? 1 : 0) : (options.verbosity || 0)
|
|
61
62
|
let index = 0
|
|
62
63
|
let iterators = []
|