Add integer check for alphabet size
Fixes "Generate De Bruijn Sequence - RangeError in blob:null/6895a5cc-cf19-4023-b300-36e358dad354 on line 2.<br><br>Message: invalid array length"
This commit is contained in:
parent
6a3a370bb1
commit
e720557783
@ -50,6 +50,10 @@ class GenerateDeBruijnSequence extends Operation {
|
|||||||
throw new OperationError("Invalid alphabet size, required to be between 2 and 9 (inclusive).");
|
throw new OperationError("Invalid alphabet size, required to be between 2 and 9 (inclusive).");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Number.isInteger(k)) {
|
||||||
|
throw new OperationError("Invalid alphabet size, 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