1.0.3 • Published 4 years ago

@perfectcircle93m/randomid-generator v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

Install

$ npm install @perfectcircle93m/randomid-generator

Usage

Generate random ID string

const randomID = (idLength) => {
    let id = '';
    const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
    const charsAmount = characters.length;
    for(let i = 0; i < idLength; i++) {
        id += characters.charAt(Math.floor(Math.random() * charsAmount));
    }
    return id;
  }


module.exports = randomID;

Author

Magdalena Świderska

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago