File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ export interface RecordSetStore<T extends string | number> extends Writable<Reco
99
99
add : ( item : T ) => void ;
100
100
addAll : ( items : T [ ] ) => void ;
101
101
remove : ( item : T ) => void ;
102
+ removeAll : ( items : T [ ] ) => void ;
102
103
clear : ( ) => void ;
103
104
}
104
105
@@ -145,6 +146,14 @@ export const recordSetStore = <T extends string | number>(
145
146
return $recordSet ;
146
147
} ) ;
147
148
} ;
149
+ const removeAll = ( items : T [ ] ) => {
150
+ update ( ( $recordSet ) => {
151
+ for ( const item of items ) {
152
+ delete $recordSet [ item ] ;
153
+ }
154
+ return $recordSet ;
155
+ } ) ;
156
+ } ;
148
157
const clear = ( ) => {
149
158
set ( { } as Record < T , true > ) ;
150
159
} ;
@@ -156,6 +165,7 @@ export const recordSetStore = <T extends string | number>(
156
165
add,
157
166
addAll,
158
167
remove,
168
+ removeAll,
159
169
clear,
160
170
} ;
161
171
} ;
You can’t perform that action at this time.
0 commit comments