defered-branch 2.2.4 β†’ 2.2.6

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.
Files changed (3) hide show
  1. package/README.md +22 -21
  2. package/dist/index.d.ts +11 -12
  3. package/package.json +2 -19
package/README.md CHANGED
@@ -4,20 +4,20 @@ 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="features"></a>
20
+ <a id="user-content-features"></a>
21
21
 
22
22
  - 🎯 **Four Execution Patterns**: Single/all-match Γ— immediate/dynamic logic
23
23
  - πŸ”’ **Type Safe**: Full TypeScript support with type inference
@@ -27,11 +27,12 @@ For more awesome packages, check out [my homepageπŸ’›](https://baendlorel.github
27
27
 
28
28
  ## Change Log
29
29
 
30
- <a id="change-log"></a>
30
+ <a id="user-content-change-log"></a>
31
31
 
32
- - 2.2.1-2.2.3
32
+ - 2.2.1-2.2.5
33
33
  - Fix: Clear matched branch after execution to prevent stale state issues.
34
34
  - Add index to this document.
35
+ - Fixing anchors for npm many times πŸ’’
35
36
 
36
37
  - 2.2.0
37
38
  - Add `deferedBranchAll` and `deferedBranchAllDynamic` for multi-match scenarios.
@@ -39,7 +40,7 @@ For more awesome packages, check out [my homepageπŸ’›](https://baendlorel.github
39
40
 
40
41
  ## Installation
41
42
 
42
- <a id="installation"></a>
43
+ <a id="user-content-installation"></a>
43
44
 
44
45
  ```bash
45
46
  npm install defered-branch
@@ -49,7 +50,7 @@ pnpm add defered-branch
49
50
 
50
51
  ## Overview
51
52
 
52
- <a id="overview"></a>
53
+ <a id="user-content-overview"></a>
53
54
 
54
55
  ### `deferedBranch` - Single-Match Immediate πŸƒβ€β™‚οΈ
55
56
 
@@ -77,7 +78,7 @@ Reusable branching logic, execute all matches dynamically.
77
78
 
78
79
  ## Usage Examples
79
80
 
80
- <a id="usage-examples"></a>
81
+ <a id="user-content-usage-examples"></a>
81
82
 
82
83
  ### Basic `deferedBranch`
83
84
 
@@ -216,7 +217,7 @@ function h<T extends HTMLTag>(
216
217
 
217
218
  ## API Reference
218
219
 
219
- <a id="api-reference"></a>
220
+ <a id="user-content-api-reference"></a>
220
221
 
221
222
  ### deferedBranch()
222
223
 
@@ -280,7 +281,7 @@ _Same as deferedBranchDynamic_
280
281
 
281
282
  ## Type Annotation
282
283
 
283
- <a id="type-annotation"></a>
284
+ <a id="user-content-type-annotation"></a>
284
285
 
285
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.
286
287
 
@@ -339,19 +340,19 @@ const result = calc.run(2, 3); // typed as number | undefined
339
340
 
340
341
  ## License
341
342
 
342
- <a id="license"></a>
343
+ <a id="user-content-license"></a>
343
344
 
344
345
  MIT License - see [LICENSE](LICENSE) file for details.
345
346
 
346
347
  ## Contributing
347
348
 
348
- <a id="contributing"></a>
349
+ <a id="user-content-contributing"></a>
349
350
 
350
351
  Contributions are welcome! Please feel free to submit issues and pull requests.
351
352
 
352
353
  ## Trivia
353
354
 
354
- <a id="trivia"></a>
355
+ <a id="user-content-trivia"></a>
355
356
 
356
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.
357
358
 
package/dist/index.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ type AnyFn = (...args: any[]) => any;
2
+ type Predicate<Fn extends AnyFn> = (...args: Parameters<Fn>) => boolean;
3
+
1
4
  declare class DeferedBranch<BranchFn extends AnyFn, NoMatchFn extends AnyFn> {
2
5
  private _branch;
3
6
  /**
@@ -138,12 +141,12 @@ declare class DeferedBranchAll<BranchFn extends AnyFn, NoMatchFn extends AnyFn>
138
141
  * ## About
139
142
  * @package DeferedBranch
140
143
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
141
- * @version 2.2.4 (Last Update: 2025.09.21 18:53:18.840)
144
+ * @version 2.2.6 (Last Update: 2026.02.13 14:27:19.626)
142
145
  * @license MIT
143
146
  * @link https://github.com/baendlorel/defered-branch
144
147
  * @link https://baendlorel.github.io/ Welcome to my site!
145
148
  * @description Sometimes we need to judge something with multiple cases, but the main job should be done later. So we have Defered Branch!
146
- * @copyright Copyright (c) 2025 Kasukabe Tsumugi. All rights reserved.
149
+ * @copyright Copyright (c) 2026 Kasukabe Tsumugi. All rights reserved.
147
150
  */
148
151
  declare const deferedBranch: <BranchFn extends AnyFn = AnyFn, NoMatchFn extends AnyFn = AnyFn>() => DeferedBranch<BranchFn, NoMatchFn>;
149
152
  /**
@@ -179,12 +182,12 @@ declare const deferedBranch: <BranchFn extends AnyFn = AnyFn, NoMatchFn extends
179
182
  * ## About
180
183
  * @package DeferedBranch
181
184
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
182
- * @version 2.2.4 (Last Update: 2025.09.21 18:53:18.840)
185
+ * @version 2.2.6 (Last Update: 2026.02.13 14:27:19.626)
183
186
  * @license MIT
184
187
  * @link https://github.com/baendlorel/defered-branch
185
188
  * @link https://baendlorel.github.io/ Welcome to my site!
186
189
  * @description Sometimes we need to judge something with multiple cases, but the main job should be done later. So we have Defered Branch!
187
- * @copyright Copyright (c) 2025 Kasukabe Tsumugi. All rights reserved.
190
+ * @copyright Copyright (c) 2026 Kasukabe Tsumugi. All rights reserved.
188
191
  */
189
192
  declare const deferedBranchDynamic: <BranchFn extends AnyFn = AnyFn, NoMatchFn extends AnyFn = AnyFn, ConditionFn extends AnyFn = Predicate<BranchFn>>() => DeferedBranchDynamic<BranchFn, NoMatchFn, ConditionFn>;
190
193
  /**
@@ -213,12 +216,12 @@ declare const deferedBranchDynamic: <BranchFn extends AnyFn = AnyFn, NoMatchFn e
213
216
  * ## About
214
217
  * @package DeferedBranch
215
218
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
216
- * @version 2.2.4 (Last Update: 2025.09.21 18:53:18.840)
219
+ * @version 2.2.6 (Last Update: 2026.02.13 14:27:19.626)
217
220
  * @license MIT
218
221
  * @link https://github.com/baendlorel/defered-branch
219
222
  * @link https://baendlorel.github.io/ Welcome to my site!
220
223
  * @description Sometimes we need to judge something with multiple cases, but the main job should be done later. So we have Defered Branch!
221
- * @copyright Copyright (c) 2025 Kasukabe Tsumugi. All rights reserved.
224
+ * @copyright Copyright (c) 2026 Kasukabe Tsumugi. All rights reserved.
222
225
  */
223
226
  declare const deferedBranchAll: <BranchFn extends AnyFn = AnyFn, NoMatchFn extends AnyFn = AnyFn>() => DeferedBranchAll<BranchFn, NoMatchFn>;
224
227
  /**
@@ -254,17 +257,13 @@ declare const deferedBranchAll: <BranchFn extends AnyFn = AnyFn, NoMatchFn exten
254
257
  * ## About
255
258
  * @package DeferedBranch
256
259
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
257
- * @version 2.2.4 (Last Update: 2025.09.21 18:53:18.840)
260
+ * @version 2.2.6 (Last Update: 2026.02.13 14:27:19.626)
258
261
  * @license MIT
259
262
  * @link https://github.com/baendlorel/defered-branch
260
263
  * @link https://baendlorel.github.io/ Welcome to my site!
261
264
  * @description Sometimes we need to judge something with multiple cases, but the main job should be done later. So we have Defered Branch!
262
- * @copyright Copyright (c) 2025 Kasukabe Tsumugi. All rights reserved.
265
+ * @copyright Copyright (c) 2026 Kasukabe Tsumugi. All rights reserved.
263
266
  */
264
267
  declare const deferedBranchAllDynamic: <BranchFn extends AnyFn = AnyFn, NoMatchFn extends AnyFn = AnyFn, ConditionFn extends AnyFn = Predicate<BranchFn>>() => DeferedBranchAllDynamic<BranchFn, NoMatchFn, ConditionFn>;
265
268
 
266
269
  export { deferedBranch, deferedBranchAll, deferedBranchAllDynamic, deferedBranchDynamic };
267
-
268
- // # from: src/global.d.ts
269
- type AnyFn = (...args: any[]) => any;
270
- type Predicate<Fn extends AnyFn> = (...args: Parameters<Fn>) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "defered-branch",
3
- "version": "2.2.4",
3
+ "version": "2.2.6",
4
4
  "author": {
5
5
  "name": "Kasukabe Tsumugi",
6
6
  "email": "futami16237@gmail.com"
@@ -37,22 +37,5 @@
37
37
  "build": "node ./scripts/rollup.mjs"
38
38
  },
39
39
  "license": "MIT",
40
- "devDependencies": {
41
- "@rollup/plugin-alias": "^5.1.1",
42
- "@rollup/plugin-node-resolve": "^16.0.1",
43
- "@rollup/plugin-replace": "^6.0.2",
44
- "@rollup/plugin-terser": "^0.4.4",
45
- "@rollup/plugin-typescript": "^12.1.4",
46
- "@types/node": "^24.5.2",
47
- "@vitest/coverage-v8": "^3.2.4",
48
- "oxlint": "^1.16.0",
49
- "prettier": "^3.6.2",
50
- "rimraf": "^6.0.1",
51
- "rollup": "^4.50.2",
52
- "rollup-plugin-dts": "^6.2.3",
53
- "rollup-plugin-dts-merger": "^1.2.4",
54
- "tslib": "^2.8.1",
55
- "typescript": "^5.9.2",
56
- "vitest": "^3.2.4"
57
- }
40
+ "devDependencies": {}
58
41
  }