Sha256: c249cafc1144090bcc3e3a88beec734cca6ee88bd3eb2c467e4a49c399e5816d
Contents?: true
Size: 620 Bytes
Versions: 69
Compression:
Stored size: 620 Bytes
Contents
define(function () { /** * Set query string parameter value */ function setParam(url, paramName, value){ url = url || ''; var re = new RegExp('(\\?|&)'+ paramName +'=[^&]*' ); var param = paramName +'='+ encodeURIComponent( value ); if ( re.test(url) ) { return url.replace(re, '$1'+ param); } else { if (url.indexOf('?') === -1) { url += '?'; } if (url.indexOf('=') !== -1) { url += '&'; } return url + param; } } return setParam; });
Version data entries
69 entries across 69 versions & 2 rubygems