Have ideas to improve npm?Join in the discussion! »

    n-vgen
    TypeScript icon, indicating that this package has built-in type declarations

    0.3.0 • Public • Published

    n-vgen

    Build Status Code Coverage npm version

    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.

    Install

    npm i n-vgen

    DownloadsWeekly Downloads

    5

    Version

    0.3.0

    License

    MIT

    Unpacked Size

    4.42 kB

    Total Files

    6

    Last publish

    Collaborators

    • avatar