defered-branch 2.2.3 β 2.2.5
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 +32 -11
- package/dist/index.d.ts +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,19 +4,21 @@ 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
|
-
- [π 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)
|
|
7
|
+
- [π Features](#user-content-features)
|
|
8
|
+
- [β²οΈ Change Log](#user-content-change-log)
|
|
9
|
+
- [π¦ Installation](#user-content-installation)
|
|
10
|
+
- [π Overview](#user-content-overview)
|
|
11
|
+
- [π Usage Examples](#user-content-usage-examples)
|
|
12
|
+
- [π§ API Reference](#user-content-api-reference)
|
|
13
|
+
- [π§Ύ Type Annotation](#user-content-type-annotation)
|
|
14
|
+
- [π License](#user-content-license)
|
|
15
|
+
- [π€ Contributing](#user-content-contributing)
|
|
16
|
+
- [π¦ Trivia](#user-content-trivia)
|
|
17
17
|
|
|
18
18
|
## Features
|
|
19
19
|
|
|
20
|
+
<a id="user-content-features"></a>
|
|
21
|
+
|
|
20
22
|
- π― **Four Execution Patterns**: Single/all-match Γ immediate/dynamic logic
|
|
21
23
|
- π **Type Safe**: Full TypeScript support with type inference
|
|
22
24
|
- πͺΆ **Lightweight**: Zero dependencies, minimal footprint
|
|
@@ -25,9 +27,12 @@ For more awesome packages, check out [my homepageπ](https://baendlorel.github
|
|
|
25
27
|
|
|
26
28
|
## Change Log
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
<a id="user-content-change-log"></a>
|
|
31
|
+
|
|
32
|
+
- 2.2.1-2.2.5
|
|
29
33
|
- Fix: Clear matched branch after execution to prevent stale state issues.
|
|
30
34
|
- Add index to this document.
|
|
35
|
+
- Fixing anchors for npm many times π’
|
|
31
36
|
|
|
32
37
|
- 2.2.0
|
|
33
38
|
- Add `deferedBranchAll` and `deferedBranchAllDynamic` for multi-match scenarios.
|
|
@@ -35,6 +40,8 @@ For more awesome packages, check out [my homepageπ](https://baendlorel.github
|
|
|
35
40
|
|
|
36
41
|
## Installation
|
|
37
42
|
|
|
43
|
+
<a id="user-content-installation"></a>
|
|
44
|
+
|
|
38
45
|
```bash
|
|
39
46
|
npm install defered-branch
|
|
40
47
|
# or
|
|
@@ -43,6 +50,8 @@ pnpm add defered-branch
|
|
|
43
50
|
|
|
44
51
|
## Overview
|
|
45
52
|
|
|
53
|
+
<a id="user-content-overview"></a>
|
|
54
|
+
|
|
46
55
|
### `deferedBranch` - Single-Match Immediate πββοΈ
|
|
47
56
|
|
|
48
57
|
Evaluate conditions once, execute first match immediately.
|
|
@@ -69,6 +78,8 @@ Reusable branching logic, execute all matches dynamically.
|
|
|
69
78
|
|
|
70
79
|
## Usage Examples
|
|
71
80
|
|
|
81
|
+
<a id="user-content-usage-examples"></a>
|
|
82
|
+
|
|
72
83
|
### Basic `deferedBranch`
|
|
73
84
|
|
|
74
85
|
```typescript
|
|
@@ -206,6 +217,8 @@ function h<T extends HTMLTag>(
|
|
|
206
217
|
|
|
207
218
|
## API Reference
|
|
208
219
|
|
|
220
|
+
<a id="user-content-api-reference"></a>
|
|
221
|
+
|
|
209
222
|
### deferedBranch()
|
|
210
223
|
|
|
211
224
|
Creates a new deferred branch instance for immediate execution scenarios.
|
|
@@ -268,6 +281,8 @@ _Same as deferedBranchDynamic_
|
|
|
268
281
|
|
|
269
282
|
## Type Annotation
|
|
270
283
|
|
|
284
|
+
<a id="user-content-type-annotation"></a>
|
|
285
|
+
|
|
271
286
|
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.
|
|
272
287
|
|
|
273
288
|
Below is an example using `deferedBranch`:
|
|
@@ -325,14 +340,20 @@ const result = calc.run(2, 3); // typed as number | undefined
|
|
|
325
340
|
|
|
326
341
|
## License
|
|
327
342
|
|
|
343
|
+
<a id="user-content-license"></a>
|
|
344
|
+
|
|
328
345
|
MIT License - see [LICENSE](LICENSE) file for details.
|
|
329
346
|
|
|
330
347
|
## Contributing
|
|
331
348
|
|
|
349
|
+
<a id="user-content-contributing"></a>
|
|
350
|
+
|
|
332
351
|
Contributions are welcome! Please feel free to submit issues and pull requests.
|
|
333
352
|
|
|
334
353
|
## Trivia
|
|
335
354
|
|
|
355
|
+
<a id="user-content-trivia"></a>
|
|
356
|
+
|
|
336
357
|
[**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.
|
|
337
358
|
|
|
338
359
|
---
|
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.5 (Last Update: 2025.09.21 19:14:47.820)
|
|
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.5 (Last Update: 2025.09.21 19:14:47.820)
|
|
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.5 (Last Update: 2025.09.21 19:14:47.820)
|
|
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.5 (Last Update: 2025.09.21 19:14:47.820)
|
|
258
258
|
* @license MIT
|
|
259
259
|
* @link https://github.com/baendlorel/defered-branch
|
|
260
260
|
* @link https://baendlorel.github.io/ Welcome to my site!
|