$.char.random

Random method of char helpers

This random helper can be use for generating random password, unique ID, custom color, and so on. Random method only have 2 arguments, the length of character and the type of character (only accept long, short, narrow, hex and number type).

$.char.random(lengthOfCharacter, typeOfCharacter)

// Example:
$.char.random() // length is 11 and 'long' as default type
//=> Oht,^o%JfeV

$.char.random(6, 'hex') // add '#' manually by yourself
//=> afe865

$.char.random(3, 'number')
//=> 430

$.char.random(11, 'short')
//=> 4eF5m_0C75L

$.char.random(8, 'narrow')
//=> zxtlxj7m

Also, we provide real world application example like this show/hide password generator that use Petite-Vue and this random method.

Visit this link: https://codepen.io/tedirghazali/pen/GRmyqKB

Last updated