10 examples of 'jquery urlencode' in JavaScript

Every line of 'jquery urlencode' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
60function urlencode(str) {
61 str = (str + '').toString();
62
63 return encodeURIComponent(str)
64 .replace(/!/g, '%21')
65 .replace(/'/g, '%27')
66 .replace(/\(/g, '%28')
67 .replace(/\)/g, '%29')
68 .replace(/\*/g, '%2A')
69 .replace(/%20/g, '+');
70}
104function urlencode(o) {
105 var qs = [];
106 for (var k in o) qs.push(k + '=' + encodeURIComponent(o[k]));
107 return qs.join('&');
108}
184function urlEncode_(str) {
185 return encodeURIComponent(String(str));
186}
191function base64urlEncode(s) {
192 return btoa(s).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
193}
65export function urlEncode(obj, prefix) {
66 var str = []
67
68 for (var p in obj) {
69 if (obj.hasOwnProperty(p)) {
70 var k = prefix ? prefix + '[' + p + ']' : p
71 var v = obj[p]
72
73 str.push(
74 typeof v === 'object'
75 ? urlEncode(v, k)
76 : encodeURIComponent(k) + '=' + encodeURIComponent(v)
77 )
78 }
79 }
80 return str.join('&')
81}
1export function urlEncode(data: any) {
2 return Object.keys(data)
3 .filter(key => data[key] !== undefined)
4 .map(key => `${key}=${encodeURIComponent(data[key])}`)
5 .join('&');
6}
127function urlEncode(unencoded) {
128 return encodeURIComponent(unencoded).replace(/'/g,'%27').replace(/"/g,'%22')
129}
45function base64UrlEncode(data) {
46 var chop;
47 data = base64Encode(data);
48 chop = data.indexOf('=');
49 if (chop !== -1) {
50 data = data.slice(0, chop);
51 }
52 data = data.replace(/\+/g, '-');
53 data = data.replace(/\//g, '_');
54 return data;
55}
74function base64urlEncode(str) {
75 return new Buffer(str).toString('base64');
76}
446encodeParams (params) {
447 return this.urlencode (this.keysort (params));
448}

Related snippets