defered-branch 2.1.0 → 2.1.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/dist/index.d.ts +14 -6
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ declare class DeferBranchDynamic<BranchFn extends AnyFn, NoMatchFn extends AnyFn
|
|
|
51
51
|
/**
|
|
52
52
|
* Run the condition to find the first matched branch
|
|
53
53
|
*/
|
|
54
|
-
predicate(...args: Parameters<
|
|
54
|
+
predicate(...args: Parameters<ConditionFn>): void;
|
|
55
55
|
/**
|
|
56
56
|
* If some branch matched, return its returnValue
|
|
57
57
|
* @param args arguments to pass to the matched branch
|
|
@@ -77,13 +77,15 @@ declare class DeferBranchDynamic<BranchFn extends AnyFn, NoMatchFn extends AnyFn
|
|
|
77
77
|
* a.add(true, someFn satisfies BranchFn);
|
|
78
78
|
* a.nomatch(otherFn satisfies NoMatchFn);
|
|
79
79
|
*
|
|
80
|
-
*
|
|
80
|
+
* // some other logic
|
|
81
|
+
*
|
|
82
|
+
* a.run(...args); // input args are restricted to Parameters<BranchFn>
|
|
81
83
|
* ```
|
|
82
84
|
*
|
|
83
85
|
* ## About
|
|
84
86
|
* @package DeferedBranch
|
|
85
87
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
86
|
-
* @version 2.1.
|
|
88
|
+
* @version 2.1.2 (Last Update: 2025.09.21 09:09:48.701)
|
|
87
89
|
* @license MIT
|
|
88
90
|
* @link https://github.com/baendlorel/defered-branch
|
|
89
91
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -109,16 +111,22 @@ declare const deferedBranch: <BranchFn extends AnyFn = AnyFn, NoMatchFn extends
|
|
|
109
111
|
* const a = deferedBranch<BranchFn, NoMatchFn, ConditionFn>();
|
|
110
112
|
*
|
|
111
113
|
* // then we have restrictions:
|
|
112
|
-
* a.add(someFn
|
|
114
|
+
* a.add(someFn satisfies ConditionFn, secondFn satisfies BranchFn);
|
|
113
115
|
* a.nomatch(thirdFn satisfies NoMatchFn);
|
|
114
116
|
*
|
|
115
|
-
*
|
|
117
|
+
* // some other logic
|
|
118
|
+
*
|
|
119
|
+
* a.predicate(...args);
|
|
120
|
+
*
|
|
121
|
+
* // some other logic
|
|
122
|
+
*
|
|
123
|
+
* a.run(...args); // input args are restricted to Parameters<BranchFn>
|
|
116
124
|
* ```
|
|
117
125
|
*
|
|
118
126
|
* ## About
|
|
119
127
|
* @package DeferedBranch
|
|
120
128
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
121
|
-
* @version 2.1.
|
|
129
|
+
* @version 2.1.2 (Last Update: 2025.09.21 09:09:48.701)
|
|
122
130
|
* @license MIT
|
|
123
131
|
* @link https://github.com/baendlorel/defered-branch
|
|
124
132
|
* @link https://baendlorel.github.io/ Welcome to my site!
|