@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.
Files changed (2) hide show
  1. package/README.md +31 -16
  2. package/package.json +6 -6
package/README.md CHANGED
@@ -1,16 +1,31 @@
1
- # ![alt text](https://avatars1.githubusercontent.com/u/64487547?s=30 "tsdotnet") tsdotnet / parallel
2
-
3
- [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/tsdotnet/parallel/blob/master/LICENSE)
4
- [![npm version](https://img.shields.io/npm/v/@tsdotnet/parallel.svg?style=flat-square)](https://www.npmjs.com/package/@tsdotnet/parallel)
5
-
6
- A utility for automatically partitioning tasks (promises) and executing them in parallel using separate processes or web workers.
7
-
8
- ## Docs
9
-
10
- [tsdotnet.github.io/parallel](https://tsdotnet.github.io/parallel/)
11
-
12
- ## Demo
13
-
14
- [**Genetic Algorithm Parallelized (multi-process) in NodeJS & Browser!**](https://youtu.be/gy-cQuEMfqs)
15
-
16
- [![Genetic Algorithm Parallelized (multi-process) in NodeJS & Browser!](https://i.ytimg.com/vi/gy-cQuEMfqs/hqdefault.jpg?sqp=-oaymwEZCNACELwBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLDBsZWDiGqlR0F70gDJwmPIB5W57w)](https://youtu.be/gy-cQuEMfqs)
1
+ <a name="banner"><img src="https://cdn.jsdelivr.net/gh/tsdotnet/parallel@master/assets/banner.svg" alt="@tsdotnet/parallel: Spread the work, gather it. Run tasks in parallel workers."></a>
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@tsdotnet/parallel.svg?style=flat-square)](https://www.npmjs.com/package/@tsdotnet/parallel)
4
+ [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](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.0",
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.1",
69
- "@tsdotnet/object-pool": "^2.1.1",
70
- "@tsdotnet/promises": "^2.1.1",
71
- "@tsdotnet/stopwatch": "^2.1.1",
72
- "@tsdotnet/threading": "^2.1.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": {