mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-23 00:06:17 -04:00
fix linting
This commit is contained in:
parent
bd51fc05e3
commit
fa51addfd5
1 changed files with 5 additions and 5 deletions
|
@ -54,7 +54,7 @@ class URLEncode extends Operation {
|
||||||
* @param {string} str
|
* @param {string} str
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
frontPad (str, length, char){
|
frontPad (str, length, char) {
|
||||||
return str.length >= length ? str : (char * (length - str.length)) + str;
|
return str.length >= length ? str : (char * (length - str.length)) + str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,8 +67,8 @@ class URLEncode extends Operation {
|
||||||
encodeAllSpecialChars (str) {
|
encodeAllSpecialChars (str) {
|
||||||
const specialChars = "!#'()*-._~";
|
const specialChars = "!#'()*-._~";
|
||||||
let encoded = "";
|
let encoded = "";
|
||||||
for (var char of str) {
|
for (let char of str) {
|
||||||
if (encodeURIComponent(char) === char && specialChars.includes(char)){
|
if (encodeURIComponent(char) === char && specialChars.includes(char)) {
|
||||||
encoded += "%" + this.frontPad(char.charCodeAt(0).toString(16).toUpperCase(), 2, "0");
|
encoded += "%" + this.frontPad(char.charCodeAt(0).toString(16).toUpperCase(), 2, "0");
|
||||||
} else {
|
} else {
|
||||||
encoded += encodeURIComponent(char);
|
encoded += encodeURIComponent(char);
|
||||||
|
@ -85,8 +85,8 @@ class URLEncode extends Operation {
|
||||||
*/
|
*/
|
||||||
encodeAllChars (str) {
|
encodeAllChars (str) {
|
||||||
let encoded = "";
|
let encoded = "";
|
||||||
for (var char of str) {
|
for (let char of str) {
|
||||||
encoded += "%" + this.frontPad(char.charCodeAt(0).toString(16).toUpperCase(), 2, "0")
|
encoded += "%" + this.frontPad(char.charCodeAt(0).toString(16).toUpperCase(), 2, "0");
|
||||||
}
|
}
|
||||||
return encoded;
|
return encoded;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue