triangle-utils 1.4.120 → 1.4.121

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.
@@ -12,7 +12,7 @@ export declare class UtilsMisc {
12
12
  verbosity?: number | boolean;
13
13
  }): Promise<(U | undefined)[]>;
14
14
  batch_iterate<T, U>(inputs: T[], f: (inputs: T[], iterator_id: number, index: number) => Promise<U>, options: {
15
- batch_size?: number;
15
+ batch_num_items?: number;
16
16
  num_iterators?: number;
17
17
  verbosity?: number | boolean;
18
18
  }): Promise<(U | undefined)[]>;
@@ -44,7 +44,7 @@ export class UtilsMisc {
44
44
  return outputs;
45
45
  }
46
46
  async batch_iterate(inputs, f, options) {
47
- const batch_size = options.batch_size || 1;
47
+ const batch_num_items = options.batch_num_items || 1;
48
48
  const num_iterators = options.num_iterators || 1;
49
49
  const verbosity = typeof options.verbosity === "boolean" ? (options.verbosity === true ? 1 : 0) : (options.verbosity || 0);
50
50
  let index = 0;
@@ -54,11 +54,11 @@ export class UtilsMisc {
54
54
  iterators.push((async () => {
55
55
  while (index < inputs.length) {
56
56
  const local_index = index;
57
- index += batch_size;
57
+ index += batch_num_items;
58
58
  if (verbosity !== undefined && (local_index % verbosity === 0)) {
59
59
  console.log(iterator_id + ":" + local_index + "/" + inputs.length);
60
60
  }
61
- const output = await this.safe_run(() => f(inputs.slice(local_index, local_index + batch_size), iterator_id, local_index));
61
+ const output = await this.safe_run(() => f(inputs.slice(local_index, local_index + batch_num_items), iterator_id, local_index));
62
62
  outputs[local_index] = output;
63
63
  }
64
64
  })());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-utils",
3
- "version": "1.4.120",
3
+ "version": "1.4.121",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
package/src/UtilsMisc.ts CHANGED
@@ -55,8 +55,8 @@ export class UtilsMisc {
55
55
  }
56
56
 
57
57
  async batch_iterate<T, U>(inputs : T[], f : (inputs : T[], iterator_id : number, index : number) => Promise<U>,
58
- options : { batch_size? : number, num_iterators? : number, verbosity? : number | boolean }) {
59
- const batch_size = options.batch_size || 1
58
+ options : { batch_num_items? : number, num_iterators? : number, verbosity? : number | boolean }) {
59
+ const batch_num_items = options.batch_num_items || 1
60
60
  const num_iterators = options.num_iterators || 1
61
61
  const verbosity : number = typeof options.verbosity === "boolean" ? (options.verbosity === true ? 1 : 0) : (options.verbosity || 0)
62
62
  let index = 0
@@ -66,11 +66,11 @@ export class UtilsMisc {
66
66
  iterators.push((async () => {
67
67
  while (index < inputs.length) {
68
68
  const local_index = index
69
- index += batch_size
69
+ index += batch_num_items
70
70
  if (verbosity !== undefined && (local_index % verbosity === 0)) {
71
71
  console.log(iterator_id + ":" + local_index + "/" + inputs.length)
72
72
  }
73
- const output = await this.safe_run(() => f(inputs.slice(local_index, local_index + batch_size), iterator_id, local_index))
73
+ const output = await this.safe_run(() => f(inputs.slice(local_index, local_index + batch_num_items), iterator_id, local_index))
74
74
  outputs[local_index] = output
75
75
  }
76
76
  })())