defered-branch 2.2.1 β 2.2.3
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 +27 -17
- package/dist/index.d.ts +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,18 @@ A lightweight library providing a if-else like branch, but with deferred executi
|
|
|
4
4
|
|
|
5
5
|
For more awesome packages, check out [my homepageπ](https://baendlorel.github.io/?repoType=npm)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- [π Features](#features)
|
|
8
|
+
- [β²οΈ Change Log](#change-log)
|
|
9
|
+
- [π¦ Installation](#installation)
|
|
10
|
+
- [π Overview](#overview)
|
|
11
|
+
- [π Usage Examples](#usage-examples)
|
|
12
|
+
- [π§ API Reference](#api-reference)
|
|
13
|
+
- [π§Ύ Type Annotation](#type-annotation)
|
|
14
|
+
- [π License](#license)
|
|
15
|
+
- [π€ Contributing](#contributing)
|
|
16
|
+
- [π¦ Trivia](#trivia)
|
|
17
|
+
|
|
18
|
+
## Features
|
|
8
19
|
|
|
9
20
|
- π― **Four Execution Patterns**: Single/all-match Γ immediate/dynamic logic
|
|
10
21
|
- π **Type Safe**: Full TypeScript support with type inference
|
|
@@ -12,18 +23,17 @@ For more awesome packages, check out [my homepageπ](https://baendlorel.github
|
|
|
12
23
|
- π§© **Flexible**: Works with any function signature
|
|
13
24
|
- π¦ **Generic**: Customizable branch, condition, and nomatch handler types
|
|
14
25
|
|
|
15
|
-
##
|
|
26
|
+
## Change Log
|
|
16
27
|
|
|
17
|
-
|
|
28
|
+
- 2.2.1-2.2.3
|
|
29
|
+
- Fix: Clear matched branch after execution to prevent stale state issues.
|
|
30
|
+
- Add index to this document.
|
|
18
31
|
|
|
19
|
-
-
|
|
32
|
+
- 2.2.0
|
|
33
|
+
- Add `deferedBranchAll` and `deferedBranchAllDynamic` for multi-match scenarios.
|
|
34
|
+
- Fix documentation typos.
|
|
20
35
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
- Add `deferedBranchAll` and `deferedBranchAllDynamic` for multi-match scenarios.
|
|
24
|
-
- Fix documentation typos.
|
|
25
|
-
|
|
26
|
-
## π¦ Installation
|
|
36
|
+
## Installation
|
|
27
37
|
|
|
28
38
|
```bash
|
|
29
39
|
npm install defered-branch
|
|
@@ -31,7 +41,7 @@ npm install defered-branch
|
|
|
31
41
|
pnpm add defered-branch
|
|
32
42
|
```
|
|
33
43
|
|
|
34
|
-
##
|
|
44
|
+
## Overview
|
|
35
45
|
|
|
36
46
|
### `deferedBranch` - Single-Match Immediate πββοΈ
|
|
37
47
|
|
|
@@ -57,7 +67,7 @@ Reusable branching logic, execute all matches dynamically.
|
|
|
57
67
|
|
|
58
68
|
**Use cases:** Plugin systems, middleware chains, observer patterns
|
|
59
69
|
|
|
60
|
-
##
|
|
70
|
+
## Usage Examples
|
|
61
71
|
|
|
62
72
|
### Basic `deferedBranch`
|
|
63
73
|
|
|
@@ -194,7 +204,7 @@ function h<T extends HTMLTag>(
|
|
|
194
204
|
}
|
|
195
205
|
```
|
|
196
206
|
|
|
197
|
-
##
|
|
207
|
+
## API Reference
|
|
198
208
|
|
|
199
209
|
### deferedBranch()
|
|
200
210
|
|
|
@@ -256,7 +266,7 @@ _Same as deferedBranch_
|
|
|
256
266
|
|
|
257
267
|
_Same as deferedBranchDynamic_
|
|
258
268
|
|
|
259
|
-
##
|
|
269
|
+
## Type Annotation
|
|
260
270
|
|
|
261
271
|
The factory functions `deferedBranch`, `deferedBranchDynamic`, `deferedBranchAll`, and `deferedBranchAllDynamic` are generic helpers. You can provide explicit type parameters to describe the branch function signature and the optional `nomatch` handler.
|
|
262
272
|
|
|
@@ -313,15 +323,15 @@ calc.predicate();
|
|
|
313
323
|
const result = calc.run(2, 3); // typed as number | undefined
|
|
314
324
|
```
|
|
315
325
|
|
|
316
|
-
##
|
|
326
|
+
## License
|
|
317
327
|
|
|
318
328
|
MIT License - see [LICENSE](LICENSE) file for details.
|
|
319
329
|
|
|
320
|
-
##
|
|
330
|
+
## Contributing
|
|
321
331
|
|
|
322
332
|
Contributions are welcome! Please feel free to submit issues and pull requests.
|
|
323
333
|
|
|
324
|
-
##
|
|
334
|
+
## Trivia
|
|
325
335
|
|
|
326
336
|
[**KT.js**](https://www.npmjs.com/package/kt.js) is the reason of this package's birth. It uses `deferedBranchDynamic` internally to handle attribute and content processing in a clean, reusable way.
|
|
327
337
|
|
package/dist/index.d.ts
CHANGED
|
@@ -138,7 +138,7 @@ declare class DeferedBranchAll<BranchFn extends AnyFn, NoMatchFn extends AnyFn>
|
|
|
138
138
|
* ## About
|
|
139
139
|
* @package DeferedBranch
|
|
140
140
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
141
|
-
* @version 2.2.
|
|
141
|
+
* @version 2.2.3 (Last Update: 2025.09.21 18:48:42.785)
|
|
142
142
|
* @license MIT
|
|
143
143
|
* @link https://github.com/baendlorel/defered-branch
|
|
144
144
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -179,7 +179,7 @@ declare const deferedBranch: <BranchFn extends AnyFn = AnyFn, NoMatchFn extends
|
|
|
179
179
|
* ## About
|
|
180
180
|
* @package DeferedBranch
|
|
181
181
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
182
|
-
* @version 2.2.
|
|
182
|
+
* @version 2.2.3 (Last Update: 2025.09.21 18:48:42.785)
|
|
183
183
|
* @license MIT
|
|
184
184
|
* @link https://github.com/baendlorel/defered-branch
|
|
185
185
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -213,7 +213,7 @@ declare const deferedBranchDynamic: <BranchFn extends AnyFn = AnyFn, NoMatchFn e
|
|
|
213
213
|
* ## About
|
|
214
214
|
* @package DeferedBranch
|
|
215
215
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
216
|
-
* @version 2.2.
|
|
216
|
+
* @version 2.2.3 (Last Update: 2025.09.21 18:48:42.785)
|
|
217
217
|
* @license MIT
|
|
218
218
|
* @link https://github.com/baendlorel/defered-branch
|
|
219
219
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -254,7 +254,7 @@ declare const deferedBranchAll: <BranchFn extends AnyFn = AnyFn, NoMatchFn exten
|
|
|
254
254
|
* ## About
|
|
255
255
|
* @package DeferedBranch
|
|
256
256
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
257
|
-
* @version 2.2.
|
|
257
|
+
* @version 2.2.3 (Last Update: 2025.09.21 18:48:42.785)
|
|
258
258
|
* @license MIT
|
|
259
259
|
* @link https://github.com/baendlorel/defered-branch
|
|
260
260
|
* @link https://baendlorel.github.io/ Welcome to my site!
|