Add validation for key length in De Bruijn sequence
This commit is contained in:
parent
eedc3fc5a4
commit
771764068d
@ -54,6 +54,10 @@ class GenerateDeBruijnSequence extends Operation {
|
|||||||
throw new OperationError("Invalid alphabet size, required to be integer.");
|
throw new OperationError("Invalid alphabet size, required to be integer.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Number.isInteger(n)) {
|
||||||
|
throw new OperationError("Invalid key length, required to be integer.");
|
||||||
|
}
|
||||||
|
|
||||||
if (n < 2) {
|
if (n < 2) {
|
||||||
throw new OperationError("Invalid key length, required to be at least 2.");
|
throw new OperationError("Invalid key length, required to be at least 2.");
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user