Do you want to modify in-place or return a copy? If you want a copy, you can return a spread object with the filtered category.
const items = {
names: ['mike', 'larry'],
cities: ['2London']
};
const remove = (items, category, el) => ({
...items,
[category]: items[category].filter(e => e !== el)
});
const modified = remove(items, 'names', 'larry');
console.log(modified);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…