Skip to content

Instantly share code, notes, and snippets.

@bryzettler
Last active June 1, 2017 04:05
Show Gist options
  • Save bryzettler/308ce221e5c5f8d9812bd48dafa981cd to your computer and use it in GitHub Desktop.
Save bryzettler/308ce221e5c5f8d9812bd48dafa981cd to your computer and use it in GitHub Desktop.
// item is named record for easily knowing what
// we're operating on
records.reduce((acc, record) => {
// Recored is not longer than 60 mins
// return acc as is, doing nothing with record (filter)
if (record.lengthSec > (60 * 60)) return acc;
// Destructure acc into new array
// Destructure record into new object and add display prop
return [
...acc,
{
...record,
['display']: `${record.artist} - ${record.title} (${record.released})`
}
]
}, []);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment