UNPKG

choo-shortcache

Version:

choo nanocomponent cache shortcut

16 lines (11 loc) 346 B
var reg = /([^?=&]+)(=([^&]*))?/g var assert = require('assert') module.exports = qs function qs (url) { assert.equal(typeof url, 'string', 'nanoquery: url should be type string') var obj = {} url.replace(/^.*\?/, '').replace(reg, function (a0, a1, a2, a3) { obj[decodeURIComponent(a1)] = decodeURIComponent(a3) }) return obj }