@elpandev/alphanumeric_code_generator
v1.0.3
Published
transform a number into a string using a seed
Downloads
29
Readme
Alphanumeric Code Generator
Transform a number into an alphanumeric code using a custom character string
Installation
npm i @elpandev/alphanumeric_code_generator
Usage
import { CodeGenerator } from '@elpandev/alphanumeric_code_generator'
const generator = new CodeGenerator("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890")
const num = 1
const length = 7
const code = generator.generate({ num, length }) // AAAAAAA
const code1 = generator.generate({ num: 1, length: 5 }) // AAAAA
const code2 = generator.generate({ num: 2, length: 5 }) // AAAAB
const code3 = generator.generate({ num: 3, length: 5 }) // AAAAC
const code4 = generator.generate({ num: 4, length: 5 }) // AAAAD
const code5 = generator.generate({ num: 5, length: 5 }) // AAAAE
const code157415 = generator.generate({ num: 157415, length: 4 }) // Ao77
const code243678 = generator.generate({ num: 243678, length: 4 }) // BBYR
const code278593 = generator.generate({ num: 278593, length: 4 }) // BKda
const code121273 = generator.generate({ num: 121273, length: 4 }) // AfiA
const code263712 = generator.generate({ num: 263712, length: 4 }) // BGlZ