export function addOne < T > ( items = [ ] , newItem ) { return [ ... items , newItem ] ; } export function removeOne < T extends { id : string ; } > ( items = [ ] , itemId ) { return items . filter ( ( item ) => item . id !== itemId ) ; } export function removeMany < T extends { id : string ; } > ( items = [ ] , itemIds ) { return items . filter ( ( item ) => ! itemIds . includes ( item . id ) ) ; } export function updateOne < T extends { id : string ; } > ( items = [ ] , updatedItem ) { return items . map ( ( item ) => ( item . id === updatedItem . id ? updatedItem : item ) ) ; }