Run functions over data in parallel worker threads, in Node.js and the browser, with a synchronous fallback.
npm install @tsdotnet/parallelimport { Parallel } from '@tsdotnet/parallel';
const squares = Parallel.map([1, 2, 3, 4], n => n * n);
squares.then(values => console.log(values)); // [1, 4, 9, 16]Tasks run in worker threads, so each task function must be self-contained. Pass shared values with env and helper code with require.
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.