n-vgen
Features
Generates all variants for a character set.
For example, for the charset 123
and the secret length equals 2, it generates the following variants:
[
'11', '21', '31',
'12', '22', '32',
'13', '23', '33'
]
Commands
# install
npm i n-vgen
Usage
const VGenerator = require('n-vgen');
let vgen = new VGenerator('123', 2);
vgen.getNext(); // returns 111
vgen.getNext(); // returns 211
...
API
VGenerator
constructor(charset: string, secretLen: number)
-
charset
- the charset. -
secretLen
- the secret length.
totalVariants: number
Returns the total variants.
currentIndex: number
Returns the current variant's index.
getNext(): string
Returns the next variant or null if the last one is already generated.
Author
Alexander Mac
Licence
Licensed under the MIT license.