mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 23:06:16 -04:00
Some lets to consts and removing of trailing spaces from grunt lint
This commit is contained in:
parent
dcff8971e8
commit
b4a586c0b9
2 changed files with 5 additions and 5 deletions
|
@ -42,13 +42,13 @@ class A1Z26CipherDecode extends Operation {
|
||||||
*/
|
*/
|
||||||
run(input, args) {
|
run(input, args) {
|
||||||
const delim = Utils.charRep(args[0] || "Space");
|
const delim = Utils.charRep(args[0] || "Space");
|
||||||
|
|
||||||
if (input.length === 0) {
|
if (input.length === 0) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
let bites = input.split(delim),
|
const bites = input.split(delim);
|
||||||
latin1 = "";
|
let latin1 = "";
|
||||||
for (let i = 0; i < bites.length; i++) {
|
for (let i = 0; i < bites.length; i++) {
|
||||||
if (bites[i] < 1 || bites[i] > 26) {
|
if (bites[i] < 1 || bites[i] > 26) {
|
||||||
throw new OperationError("Error: all numbers must be between 1 and 26.");
|
throw new OperationError("Error: all numbers must be between 1 and 26.");
|
||||||
|
|
|
@ -42,12 +42,12 @@ class A1Z26CipherEncode extends Operation {
|
||||||
run(input, args) {
|
run(input, args) {
|
||||||
const delim = Utils.charRep(args[0] || "Space");
|
const delim = Utils.charRep(args[0] || "Space");
|
||||||
let output = "";
|
let output = "";
|
||||||
|
|
||||||
const sanitizedinput = input.toLowerCase(),
|
const sanitizedinput = input.toLowerCase(),
|
||||||
charcode = Utils.strToCharcode(sanitizedinput);
|
charcode = Utils.strToCharcode(sanitizedinput);
|
||||||
|
|
||||||
for (let i = 0; i < charcode.length; i++) {
|
for (let i = 0; i < charcode.length; i++) {
|
||||||
let ordinal = charcode[i] - 96;
|
const ordinal = charcode[i] - 96;
|
||||||
|
|
||||||
if (ordinal > 0 && ordinal <= 26) {
|
if (ordinal > 0 && ordinal <= 26) {
|
||||||
output += ordinal.toString(10) + delim;
|
output += ordinal.toString(10) + delim;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue