paralysis 1.0.1 → 1.0.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 +4 -1
- package/dist/index.d.cts +4 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +4 -1
- package/dist/index.d.mts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,6 +5,9 @@ Maps over promises concurrently.
|
|
|
5
5
|
```js
|
|
6
6
|
import parallel from "paralysis";
|
|
7
7
|
|
|
8
|
+
const ids = [1, 2, 3, 4, 5];
|
|
9
|
+
const concurrency = 2;
|
|
10
|
+
|
|
8
11
|
async function getUser(id) {
|
|
9
12
|
const response = await fetch(
|
|
10
13
|
`https://jsonplaceholder.typicode.com/users/${id}`,
|
|
@@ -13,7 +16,7 @@ async function getUser(id) {
|
|
|
13
16
|
return user;
|
|
14
17
|
}
|
|
15
18
|
|
|
16
|
-
const users = await parallel(
|
|
19
|
+
const users = await parallel(ids, getUser, concurrency);
|
|
17
20
|
```
|
|
18
21
|
|
|
19
22
|
This is similar to
|
package/dist/index.d.cts
CHANGED
|
@@ -9,6 +9,9 @@ type Promisable<T> = T | PromiseLike<T>;
|
|
|
9
9
|
* ```js
|
|
10
10
|
* import parallel from "paralysis";
|
|
11
11
|
*
|
|
12
|
+
* const ids = [1, 2, 3, 4, 5];
|
|
13
|
+
* const concurrency = 2;
|
|
14
|
+
*
|
|
12
15
|
* async function getUser(id) {
|
|
13
16
|
* const response = await fetch(
|
|
14
17
|
* `https://jsonplaceholder.typicode.com/users/${id}`,
|
|
@@ -17,7 +20,7 @@ type Promisable<T> = T | PromiseLike<T>;
|
|
|
17
20
|
* return user;
|
|
18
21
|
* }
|
|
19
22
|
*
|
|
20
|
-
* const users = await parallel(
|
|
23
|
+
* const users = await parallel(ids, getUser, concurrency);
|
|
21
24
|
* ```
|
|
22
25
|
*
|
|
23
26
|
* @param list List that is iterated over concurrently, calling `fn` for each item.
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sources":["../src/index.d.ts"],"mappings":"AAAA,KAAK,UAAU,UAAU,WAAW;;AAEpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;iBACwB,SAAS;AACjC,QAAQ,SAAS;AACjB,qCAAqC,UAAU;AAC/C;AACA,GAAG,OAAO,CAAC,KAAK;;;;","names":[]}
|
|
1
|
+
{"version":3,"file":"index.d.cts","sources":["../src/index.d.ts"],"mappings":"AAAA,KAAK,UAAU,UAAU,WAAW;;AAEpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;iBACwB,SAAS;AACjC,QAAQ,SAAS;AACjB,qCAAqC,UAAU;AAC/C;AACA,GAAG,OAAO,CAAC,KAAK;;;;","names":[]}
|
package/dist/index.d.mts
CHANGED
|
@@ -9,6 +9,9 @@ type Promisable<T> = T | PromiseLike<T>;
|
|
|
9
9
|
* ```js
|
|
10
10
|
* import parallel from "paralysis";
|
|
11
11
|
*
|
|
12
|
+
* const ids = [1, 2, 3, 4, 5];
|
|
13
|
+
* const concurrency = 2;
|
|
14
|
+
*
|
|
12
15
|
* async function getUser(id) {
|
|
13
16
|
* const response = await fetch(
|
|
14
17
|
* `https://jsonplaceholder.typicode.com/users/${id}`,
|
|
@@ -17,7 +20,7 @@ type Promisable<T> = T | PromiseLike<T>;
|
|
|
17
20
|
* return user;
|
|
18
21
|
* }
|
|
19
22
|
*
|
|
20
|
-
* const users = await parallel(
|
|
23
|
+
* const users = await parallel(ids, getUser, concurrency);
|
|
21
24
|
* ```
|
|
22
25
|
*
|
|
23
26
|
* @param list List that is iterated over concurrently, calling `fn` for each item.
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sources":["../src/index.d.ts"],"mappings":"AAAA,KAAK,UAAU,UAAU,WAAW;;AAEpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;iBACwB,SAAS;AACjC,QAAQ,SAAS;AACjB,qCAAqC,UAAU;AAC/C;AACA,GAAG,OAAO,CAAC,KAAK;;;;","names":[]}
|
|
1
|
+
{"version":3,"file":"index.d.mts","sources":["../src/index.d.ts"],"mappings":"AAAA,KAAK,UAAU,UAAU,WAAW;;AAEpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;iBACwB,SAAS;AACjC,QAAQ,SAAS;AACjB,qCAAqC,UAAU;AAC/C;AACA,GAAG,OAAO,CAAC,KAAK;;;;","names":[]}
|