What is the fastest algorithm for getting from something like this:
var array = [ [1,\'a\'], [2,\'b\'], [3,\'c\'] ];
to something like this
Terse version using modern syntax:
let objectify = a => a.reduce( (o,[k,v]) => (o[k]=v,o), {} );
I use this technique as part of a terse query string parser:
// Converts "?foo=bar&j=1&go" into { foo:'bar', j:'1', go:true }
function parseQueryString(qs) {
var q = decodeURIComponent;
return qs.replace(/^\?/,'').split('&').map(s => s.split('='))
.reduce((o,[k,v]) => (o[q(k)] = v?q(v):true, o), {});
}