Skip to content
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
This repository was archived by the owner on Jan 6, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -44,12 +44,29 @@ export function handleDOMChanges<T extends ItemInterface>(
44
44
export function handleStateChanges < T extends ItemInterface > (
45
45
normalized : Normalized < T > [ ] ,
46
46
list : T [ ]
47
+ ) : T [ ] {
48
+ const a = handleStateRemove ( normalized , list ) ;
49
+ const b = handleStateAdd ( normalized , a ) ;
50
+ return b ;
51
+ }
52
+
53
+ export function handleStateRemove < T extends ItemInterface > (
54
+ normalized : Normalized < T > [ ] ,
55
+ list : T [ ]
47
56
) : T [ ] {
48
57
const newList = [ ...list ] ;
49
58
normalized
50
59
. concat ( )
51
60
. reverse ( )
52
61
. forEach ( curr => newList . splice ( curr . oldIndex , 1 ) ) ;
62
+ return newList ;
63
+ }
64
+
65
+ export function handleStateAdd < T extends ItemInterface > (
5F8C
td>66
+ normalized : Normalized < T > [ ] ,
67
+ list : T [ ]
68
+ ) : T [ ] {
69
+ const newList = [ ...list ] ;
53
70
normalized . forEach ( curr => newList . splice ( curr . newIndex , 0 , curr . item ) ) ;
54
71
return newList ;
55
72
}
You can’t perform that action at this time.
0 commit comments