mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 23:36:16 -04:00
Converted substitute operation, added tests & moved to OperationError
This commit is contained in:
parent
350d10d98b
commit
2d6a56343b
8 changed files with 125 additions and 12 deletions
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
import Operation from "../Operation";
|
||||
|
||||
import OperationError from "../errors/OperationError";
|
||||
/**
|
||||
* Vigenère Decode operation
|
||||
*/
|
||||
|
@ -45,8 +45,8 @@ class VigenèreDecode extends Operation {
|
|||
msgIndex,
|
||||
chr;
|
||||
|
||||
if (!key) return "No key entered";
|
||||
if (!/^[a-zA-Z]+$/.test(key)) return "The key must consist only of letters";
|
||||
if (!key) throw new OperationError("No key entered");
|
||||
if (!/^[a-zA-Z]+$/.test(key)) throw new OperationError("The key must consist only of letters");
|
||||
|
||||
for (let i = 0; i < input.length; i++) {
|
||||
if (alphabet.indexOf(input[i]) >= 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue