nestworker 1.1.1 → 1.1.2

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.
Files changed (2) hide show
  1. package/README.md +4 -4
  2. package/package.json +2 -8
package/README.md CHANGED
@@ -19,11 +19,11 @@ import { executeInThread } from 'nestworker';
19
19
 
20
20
  async function calculate(): Promise<void> {
21
21
  const values = await Promise.all([
22
- executeInThread(() => 2 ** 10),
22
+ executeInThread(() => 2 ** 10), // this doesn't block the main thread
23
23
  executeInThread(() => 3 ** 10),
24
24
  ]);
25
25
 
26
- console.log(values);
26
+ console.log(values); // [1024, 59049]
27
27
  }
28
28
 
29
29
  calculate();
@@ -55,7 +55,7 @@ See the [contributing guide](https://github.com/VaheHak/nestworker/blob/master/C
55
55
 
56
56
  ## API
57
57
 
58
- ### executeInThread(task, { args: any[] }
58
+ ### `executeInThread(task, { args: any[] }`
59
59
  Runs the specified function in a separate thread.
60
60
 
61
61
  #### Parameters
@@ -65,7 +65,7 @@ Runs the specified function in a separate thread.
65
65
  - Parameter cann't be a function.
66
66
 
67
67
  ```ts
68
- const task = function([a, b, c]) { ... };
68
+ const task = function(a: number, b: object, c: boolean) { ... };
69
69
  executeInThread(task, { args: [1, {}, true] })
70
70
  ```
71
71
 
package/package.json CHANGED
@@ -1,16 +1,10 @@
1
1
  {
2
2
  "name": "nestworker",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "A lightweight tool built on top of Node.js worker_threads, enabling multithreading.",
5
5
  "author": "Vahe Hakobyan",
6
6
  "private": false,
7
7
  "license": "MIT",
8
- "licenses": [
9
- {
10
- "type": "MIT",
11
- "url": "https://github.com/VaheHak/nestworker/blob/master/LICENSE"
12
- }
13
- ],
14
8
  "scripts": {
15
9
  "prebuild": "rimraf dist",
16
10
  "build": "nest build",
@@ -40,7 +34,7 @@
40
34
  "homepage": "https://github.com/VaheHak/nestworker#readme",
41
35
  "repository": {
42
36
  "type": "git",
43
- "url": "git+https://github.com/VaheHak/nestworker.git"
37
+ "url": "https://github.com/VaheHak/nestworker.git"
44
38
  },
45
39
  "dependencies": {
46
40
  "@nestjs/common": "10.3.8"