@dmop/puru 0.1.0 → 0.1.1
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 +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,13 +9,13 @@ Works on **Node.js** and **Bun**. No separate worker files, no manual message pa
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
npm install puru
|
|
12
|
+
npm install @dmop/puru
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Quick Start
|
|
16
16
|
|
|
17
17
|
```typescript
|
|
18
|
-
import { spawn, chan, WaitGroup, select, after } from 'puru'
|
|
18
|
+
import { spawn, chan, WaitGroup, select, after } from '@dmop/puru'
|
|
19
19
|
|
|
20
20
|
// CPU work — runs in a dedicated worker thread
|
|
21
21
|
const { result } = spawn(() => fibonacci(40))
|
|
@@ -112,7 +112,7 @@ const results = await Promise.all(items.map(item => pool.run(item)))
|
|
|
112
112
|
**puru** — one file, 4 lines:
|
|
113
113
|
|
|
114
114
|
```typescript
|
|
115
|
-
import { WaitGroup } from 'puru'
|
|
115
|
+
import { WaitGroup } from '@dmop/puru'
|
|
116
116
|
const wg = new WaitGroup()
|
|
117
117
|
for (const item of items) wg.spawn(() => heavyWork(item))
|
|
118
118
|
const results = await wg.wait()
|
|
@@ -401,7 +401,7 @@ Both Promise.all and puru concurrent are fast — but puru runs everything **off
|
|
|
401
401
|
## Testing
|
|
402
402
|
|
|
403
403
|
```typescript
|
|
404
|
-
import { configure } from 'puru'
|
|
404
|
+
import { configure } from '@dmop/puru'
|
|
405
405
|
configure({ adapter: 'inline' }) // runs tasks in main thread, no real workers
|
|
406
406
|
```
|
|
407
407
|
|