To avoid Object.fromEntries, there is .reduce.
Object.fromEntries
.reduce
arr.map(o => [o[key], o]).reduce((prev, [k, v]) => { ...prev, [k]: v }, {})
Actually, with map, filter, reduce -- you can do a lot.
It is impossible to say that you cannot do something in one-liner JavaScript, because minified JS is also a one liner.
I agree. I think there're things like differenceWith in Lodash that are harder to implement by ourselves and not available in the standard library.
differenceWith
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
To avoid
Object.fromEntries
, there is.reduce
.Actually, with map, filter, reduce -- you can do a lot.
It is impossible to say that you cannot do something in one-liner JavaScript, because minified JS is also a one liner.
I agree. I think there're things like
differenceWith
in Lodash that are harder to implement by ourselves and not available in the standard library.