Functional method for storing a query string as a simple key-value object I'm working on an isomorphic javascript module (query-hash) to handle query strings and base64 tokens. It's essentially a simple key-value object with methods for taking in data and giving it back in the format you ask for.

function queryToObject(queryString) {
    return queryString.split('&amp;')
        .map(kv =&gt; kv.split('='))
        .reduce((p, kv) =&gt; {
            p[kv[0]] = decodeURIComponent(kv[1] || '').replace(/\+/g, ' ');

            return p;
        }, {});
}


For the "functional approach", mapping the array created by split() seems like unnecessary function calls. Should I be splitting the string in the reduce() method? Is there a better approach?
For this simple use case, you are correct that you could do all this work in a reduce step saving yourself an additional iteration over the array created by the split() operation.   Now whether this is enough of a performance impact for your expected use cases to move away from the (probably clearer-to-understand) map-reduce pattern is something that perhaps you would need do some testing to decide how you want to approach the problem.

If for example, you ever foresee yourself adding a filter() step, then perhaps keeping separation between map - filter - reduce steps makes sense.

I do think there are some edge cases around your basic query-split approach which might not be handled well here.  For example, what about parameters with array notation (i.e. param[]=foobar)?  You can certialny do plenty of search on the internet to gets lots of ideas on how to approach the basic query string parsing logic.