Skip to content

Instantly share code, notes, and snippets.

@jeanpaulsio
Last active January 10, 2018 09:02
Show Gist options
  • Save jeanpaulsio/ebd1aa59ba3e4f3e3b17cab7d9c87014 to your computer and use it in GitHub Desktop.
Save jeanpaulsio/ebd1aa59ba3e4f3e3b17cab7d9c87014 to your computer and use it in GitHub Desktop.
Sorted Time Data
let new_times = all_times
.slice(0)
.sort((a, b) => a.time_block - b.time_block)
.reduce((obj, item) => {
if (!obj[item.day_string]) {
obj[item.day_string] = [item]
} else {
obj[item.day_string] = [
...obj[item.day_string],
item
]
}
return obj
}, {})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment