* URL encoding of query string * @param {string} str * @return {string}
(str)
| 35 | * @return {string} |
| 36 | */ |
| 37 | function encodeQueryValue(str) { |
| 38 | return str |
| 39 | .split('&') |
| 40 | .map((v) => { |
| 41 | const key = v.split('=')[0], |
| 42 | val = v.split('=')[1]; |
| 43 | return encodeURIComponent(key) + '=' + encodeURIComponent(val); |
| 44 | }) |
| 45 | .join('&'); |
| 46 | } |
| 47 | /** |
| 48 | * If adtype is "RECTANGLE", replace it with "RECT" |
| 49 | * @param {string} str |