@tsdotnet/parallel 2.1.0 → 2.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.
- package/README.md +31 -16
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,16 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/@tsdotnet/parallel)
|
|
4
|
+
[](https://github.com/tsdotnet/parallel/blob/master/LICENSE)
|
|
5
|
+
|
|
6
|
+
Run functions over data in parallel worker threads, in Node.js and the browser, with a synchronous fallback.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install @tsdotnet/parallel
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { Parallel } from '@tsdotnet/parallel';
|
|
18
|
+
|
|
19
|
+
const squares = Parallel.map([1, 2, 3, 4], n => n * n);
|
|
20
|
+
squares.then(values => console.log(values)); // [1, 4, 9, 16]
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Tasks run in worker threads, so each task function must be self-contained. Pass shared values with `env` and helper code with `require`.
|
|
24
|
+
|
|
25
|
+
## Use it from
|
|
26
|
+
|
|
27
|
+
ESM (`import { Parallel } from '@tsdotnet/parallel';`) or CommonJS (`const { Parallel } = require('@tsdotnet/parallel');`). No `<script>` (UMD) build: use it with a bundler or Node.js.
|
|
28
|
+
|
|
29
|
+
## Docs
|
|
30
|
+
|
|
31
|
+
[tsdotnet.github.io/parallel](https://tsdotnet.github.io/parallel/)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsdotnet/parallel",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "A utility for automatically partitioning tasks (promises) and executing them in parallel using separate processes or web workers.",
|
|
5
5
|
"author": "electricessence",
|
|
6
6
|
"license": "MIT",
|
|
@@ -65,11 +65,11 @@
|
|
|
65
65
|
"vitest": "^5.1.1"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@tsdotnet/disposable": "^2.1.
|
|
69
|
-
"@tsdotnet/object-pool": "^2.1.
|
|
70
|
-
"@tsdotnet/promises": "^2.1.
|
|
71
|
-
"@tsdotnet/stopwatch": "^2.1.
|
|
72
|
-
"@tsdotnet/threading": "^2.1.
|
|
68
|
+
"@tsdotnet/disposable": "^2.1.2",
|
|
69
|
+
"@tsdotnet/object-pool": "^2.1.3",
|
|
70
|
+
"@tsdotnet/promises": "^2.1.3",
|
|
71
|
+
"@tsdotnet/stopwatch": "^2.1.3",
|
|
72
|
+
"@tsdotnet/threading": "^2.1.3",
|
|
73
73
|
"tslib": "^2.9.1"
|
|
74
74
|
},
|
|
75
75
|
"scripts": {
|