2 ms·
fromEntries(), aside from the symmetry with entries() is a really neat feature. For example `Object.fromEntries(new URLSearchParams(window.location.search))` w
by qwtel 7y ago
fromEntries(), aside from the symmetry with entries() is a really neat feature.
For example `Object.fromEntries(new URLSearchParams(window.location.search))` will parse a query string into a nice JS object. This works because the iterator of the search params class returns tuples.
What is already available today is `new URLSearchParams(Object.entries(params))` for turning a "params" object into a query string.