So long as you don't have to support older browsers, or are using Babel, new ES features do this without the need of a helper function. See the MDN docs for Object.fromEntires.
Thanks Paul, I have done some reading on this feature a few months back but hadn't seen how I could apply this to my problem.
There is another comment from ygorbunkov which demonstrates how to do this so I will have a reference point if I need to use something similar again soon!
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.
So long as you don't have to support older browsers, or are using Babel, new ES features do this without the need of a helper function. See the MDN docs for Object.fromEntires.
Thanks Paul, I have done some reading on this feature a few months back but hadn't seen how I could apply this to my problem.
There is another comment from ygorbunkov which demonstrates how to do this so I will have a reference point if I need to use something similar again soon!