If this wasn't as common, I'd probably investigate making a function that takes a predicate and an array and makes an iterator of entries that new Map() can consume.
But like this, I only iterate once to populate multiple Maps.
Plus there's the cases where I receive an object (including from JSON), so normal iteration wouldn't work:
There is often a case where I have multiple indexes, so I end up doing something like this:
If this wasn't as common, I'd probably investigate making a function that takes a predicate and an array and makes an iterator of entries that
new Map()
can consume.But like this, I only iterate once to populate multiple
Map
s.Plus there's the cases where I receive an object (including from JSON), so normal iteration wouldn't work: