vigor-fetch 1.0.3 → 1.0.4
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 +9 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,12 +12,15 @@
|
|
|
12
12
|
- 🎯 **Immutable Chaining**: Every configuration method returns a new instance, making it perfect for base templates and functional patterns.
|
|
13
13
|
|
|
14
14
|
## 📦 Installation
|
|
15
|
+
```terminal
|
|
15
16
|
|
|
16
17
|
npm install vigor-fetch
|
|
17
18
|
|
|
19
|
+
```
|
|
20
|
+
|
|
18
21
|
## 🛠️ API References
|
|
19
22
|
|
|
20
|
-
1. Vigor().fetch(origin, config)
|
|
23
|
+
1. **Vigor().fetch(origin, config)**
|
|
21
24
|
|
|
22
25
|
| Method | Type | Default | Description
|
|
23
26
|
| :--- | :--- | :--- | :--- |
|
|
@@ -42,7 +45,8 @@ npm install vigor-fetch
|
|
|
42
45
|
| .onError(...hooks) | Function[] | [] | Hooks to handle errors; can recover from error by returning a value. |
|
|
43
46
|
| .request() | Promise<T> | - | Executes the request logic including retries and hooks. |
|
|
44
47
|
|
|
45
|
-
2. Vigor().all(config)
|
|
48
|
+
2. **Vigor().all(config)**
|
|
49
|
+
|
|
46
50
|
| Method | Type | Default | Description
|
|
47
51
|
| :--- | :--- | :--- | :--- |
|
|
48
52
|
| .limit(arg) | number | 10 | Maximum number of concurrent promises running at once. |
|
|
@@ -72,7 +76,7 @@ const data = await vigor.fetch("https://api.example.com")
|
|
|
72
76
|
|
|
73
77
|
## 🛠️ Advanced Patterns
|
|
74
78
|
|
|
75
|
-
1. Request Templates
|
|
79
|
+
1. **Request Templates**
|
|
76
80
|
|
|
77
81
|
```javascript
|
|
78
82
|
|
|
@@ -90,7 +94,7 @@ const settings = await apiClient.path("/settings").request();
|
|
|
90
94
|
|
|
91
95
|
```
|
|
92
96
|
|
|
93
|
-
2. Batch Processing with Concurrency Limit
|
|
97
|
+
2. **Batch Processing with Concurrency Limit**
|
|
94
98
|
|
|
95
99
|
```javascript
|
|
96
100
|
|
|
@@ -110,7 +114,7 @@ const results = await vigor.all()
|
|
|
110
114
|
|
|
111
115
|
```
|
|
112
116
|
|
|
113
|
-
3. Middleware & Hooks
|
|
117
|
+
3. **Middleware & Hooks**
|
|
114
118
|
|
|
115
119
|
```javascript
|
|
116
120
|
|