Converted substitute operation, added tests & moved to OperationError

This commit is contained in:
Matt C 2018-05-11 16:32:19 +01:00
parent 350d10d98b
commit 2d6a56343b
8 changed files with 125 additions and 12 deletions

View file

@ -5,6 +5,7 @@
*/
import Operation from "../Operation";
import OperationError from "../errors/OperationError";
import { genPolybiusSquare } from "../lib/Ciphers";
/**
@ -50,7 +51,7 @@ class BifidCipherEncode extends Operation {
if (!/^[A-Z]+$/.test(keywordStr) && keyword.length > 0)
return "The key must consist only of letters in the English alphabet";
throw new OperationError("The key must consist only of letters in the English alphabet");
const polybius = genPolybiusSquare(keywordStr);