File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -17,8 +17,8 @@ export function formatStrategyValues(
17
17
) : SafeKey [ ] {
18
18
const valueSet = new Set ( values ) ;
19
19
20
- if ( strategy === SHOW_CHILD ) {
21
- return values . filter ( key => {
20
+ const strategyHandlers = {
21
+ [ SHOW_CHILD ] : ( key : SafeKey ) => {
22
22
const entity = keyEntities [ key ] ;
23
23
return (
24
24
! entity ||
@@ -28,14 +28,14 @@ export function formatStrategyValues(
28
28
( { node } ) => isCheckDisabled ( node ) || valueSet . has ( node [ fieldNames . value ] ) ,
29
29
)
30
30
) ;
31
- } ) ;
32
- }
33
- if ( strategy === SHOW_PARENT ) {
34
- return values . filter ( key => {
31
+ } ,
32
+ [ SHOW_PARENT ] : ( key : SafeKey ) => {
35
33
const entity = keyEntities [ key ] ;
36
- const parent = entity ? entity . parent : null ;
34
+ const parent = entity ? .parent ;
37
35
return ! parent || isCheckDisabled ( parent . node ) || ! valueSet . has ( parent . key ) ;
38
- } ) ;
39
- }
40
- return values ;
36
+ } ,
37
+ [ SHOW_ALL ] : ( ) => true ,
38
+ } ;
39
+
40
+ return values . filter ( strategyHandlers [ strategy ] || strategyHandlers [ SHOW_ALL ] ) ;
41
41
}
You can’t perform that action at this time.
0 commit comments