1- import { ComponentInt , ComponentsInt , ChildInt } from " ./interfaces.ts" ;
1+ import { ComponentInt , ComponentsInt , ChildInt } from ' ./interfaces.ts' ;
22
33interface getSelectableInt {
44 [ key : string ] : Array < number > ;
55}
66
7- function getSelectable (
8- newFocusComponent : ComponentInt ,
9- components : ComponentsInt
10- ) {
7+ function getSelectable ( newFocusComponent : ComponentInt , components : ComponentsInt ) {
118 const focusComponentId = newFocusComponent . id ;
129 const componentsToCheck = components
1310 . map ( ( comp : ComponentInt ) => comp . id )
@@ -19,12 +16,12 @@ function findAncestors(
1916 components : ComponentsInt ,
2017 currentCompArr : ComponentsInt ,
2118 componentsToCheck : ComponentsInt ,
22- ancestors : Array < number > = [ ]
19+ ancestors : Array < number > = [ ] ,
2320) : getSelectableInt {
2421 if ( ! currentCompArr . length ) {
2522 return {
26- ancestors : ancestors ,
27- selectableChildren : componentsToCheck
23+ ancestors,
24+ selectableChildren : componentsToCheck ,
2825 } ;
2926 }
3027
@@ -33,20 +30,16 @@ function findAncestors(
3330 for ( let i = 0 ; i < components . length ; i ++ ) {
3431 if ( componentsToCheck . includes ( components [ i ] . id ) ) {
3532 const myChildren = components [ i ] . childrenArray . map (
36- ( child : ChildInt ) => child . childComponentId
33+ ( child : ChildInt ) => child . childComponentId ,
3734 ) ;
3835
39- const found = currentCompArr . filter ( ( comp : ComponentInt ) =>
40- myChildren . includes ( comp )
41- ) ;
36+ const found = currentCompArr . filter ( ( comp : ComponentInt ) => myChildren . includes ( comp ) ) ;
4237
4338 if ( found . length ) {
4439 ancestors . push ( components [ i ] . id ) ;
4540 newAncestors . push ( components [ i ] . id ) ;
4641
47- const indexToDelete = componentsToCheck . findIndex (
48- ( c : Number ) => c === components [ i ] . id
49- ) ;
42+ const indexToDelete = componentsToCheck . findIndex ( ( c : Number ) => c === components [ i ] . id ) ;
5043
5144 componentsToCheck . splice ( indexToDelete , 1 ) ;
5245 }
0 commit comments