File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ export function cloneInstance<T>(origin: T) {
7
7
const prototypes = Object . getPrototypeOf ( origin ) || { } ;
8
8
Object . keys ( prototypes ) . forEach ( ( prop ) => {
9
9
if ( typeof prototypes [ prop ] === 'function' ) {
10
- console . log ( 'bind:' , prototypes [ prop ] , origin ) ;
11
10
prototypes [ prop ] . bind ( origin ) ;
12
11
}
13
12
} ) ;
@@ -16,6 +15,16 @@ export function cloneInstance<T>(origin: T) {
16
15
...prototypes ,
17
16
} ;
18
17
} catch ( e ) {
19
- console . error ( 'cloneInstance error:' , e ) ;
18
+ console . error ( 'Function cloneInstance error:' , e ) ;
20
19
}
21
20
}
21
+
22
+ /**
23
+ * Merge multiple functions to one function
24
+ * @param funcs
25
+ */
26
+ export function mergeFunctions ( ...funcs ) {
27
+ return function ( ...args ) {
28
+ funcs . filter ( ( fn ) => ! ! fn ) . forEach ( ( fn ) => fn ?.( ...args ) ) ;
29
+ } ;
30
+ }
You can’t perform that action at this time.
0 commit comments