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:
axjp 2026-05-27 14:23:31 +01:00 committed by GitHub
parent 6a3a370bb1
commit e720557783
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -50,6 +50,10 @@ class GenerateDeBruijnSequence extends Operation {
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) {
throw new OperationError("Invalid key length, required to be at least 2.");
}