mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-23 08:16:17 -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
|
@ -6,6 +6,7 @@
|
|||
* @license Apache-2.0
|
||||
*
|
||||
*/
|
||||
import OperationError from "../errors/OperationError";
|
||||
|
||||
/**
|
||||
* Affine Cipher Encode operation.
|
||||
|
@ -22,7 +23,7 @@ export function affineEncode(input, args) {
|
|||
let output = "";
|
||||
|
||||
if (!/^\+?(0|[1-9]\d*)$/.test(a) || !/^\+?(0|[1-9]\d*)$/.test(b)) {
|
||||
return "The values of a and b can only be integers.";
|
||||
throw new OperationError("The values of a and b can only be integers.");
|
||||
}
|
||||
|
||||
for (let i = 0; i < input.length; i++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue