I have an array of objects that I would like to trim down based on a specific key:value pair. I want to create an array that includes only one object per this s
key:value
Try the following function:
function trim(items){ const ids = []; return items.filter(item => ids.includes(item.id) ? false : ids.push(item.id)); }