Charset utilities. Contains helper functions related to charset.
Installation
npm install charset-utils# Or yarn add charset-utils
Usage
const getIndexVal = ;// Orconst getIndexVal = ; ;// Output: dw
Available Function
getIndexVal(index, charset) string
index
- Desired index valuecharset
- Target charset
Get charset
value based on the index
entered. Example:
;// Output: 1502 ;// Output: c ;// Output: z ;// Output: ba // With .padStart;// Output: 0006
randomIntInclusive(min, max) number
min
- Minimal random value will be generated (inclusive)max
- Max random value will be generated (inclusive)
Generate random number with min(inclusive) and max(inclusive). Example:
;// Output: 4 ;// Output: 0 ;// Output: 8
shuffleCharset(charset) string
charset
- Target charset
Randomize the entered charset. Example:
;// Output: bca ;// Output: dacb ;// Output: 214653