Skip to content

Instantly share code, notes, and snippets.

@kunle
Last active July 31, 2017 18:09
Show Gist options
  • Save kunle/189e174d9888f8b434e26f8e6915047f to your computer and use it in GitHub Desktop.
Save kunle/189e174d9888f8b434e26f8e6915047f to your computer and use it in GitHub Desktop.
Basic Query String parser
const getQueryObject = (queryString) => {
const queries = queryString ? queryString.split('&').map((e)=>{ var v = e.split('='); var n = {}; n[v[0]] = v[1]; return n}) : [];
const o = queries.reduce((p,c)=>{
return Object.assign(p,c);
},{});
return o;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment