Aucune description

common.js 365B

123456789101112
  1. /**
  2. * given an url with query parameters, this function returns all the
  3. * query parameters as an object with name and value as key and value respectively.
  4. */
  5. function parseQueryString(url) {
  6. var urlObj = {};
  7. var reg = /([^?=&]+)=([^?=&]+)/g;
  8. url.replace(reg, ($0, $1, $2) => {
  9. urlObj[$1] = decodeURIComponent($2);
  10. })
  11. return urlObj;
  12. }