My line is simple, it converts an array to an indexed object:
records.reduce(
(carry, item) => ({...carry, [item.stop_id] : item}),
{}
)
records
contains about 15k entries, but the line takes nearly half a minute to run. Is it possible to make it faster without using procedural code?