Amy Blankenship
Jan 31, 2023

--

Yes, sorry if it wasn't clear that my recommended solution is a single hash of the items with a lookup. I like to use lodash to accomplish that (I think it's underrated and a master class in functional thinking, as well as being battle tested in a way that roll-your-own isn't), but you can create a hash manually if you want. The _disadvantage_ of doing that is I don't think there's a way to do that without creating an object and mutating it to add keys. I know lodash probably does as well under the hood, but from the POV of our logic, it doesn't look like that.

--

--

Amy Blankenship
Amy Blankenship

Written by Amy Blankenship

Full Stack developer at fintech company. I mainly write about React, Javascript, Typescript, and testing.

No responses yet