Skip to main content
Version: 1.1.1

isUsername

With this method, you can check whether the username entered is correct and valid

Params

isUsername(inputUsername, options = {validChars : ['.','_']});
  • inputUsername → Username that we want to check its validity
  • validChars → An array of all the virtual characters that can be in the username. By default, only _ and . are valid. According to your needs, you can give the list of allowed characters to the pass method

Returns

true | false
  • Boolean → If the username is valid, it will return true and if the username is not valid, it will return false

Usage

isUsername("ariankoochak"); //true

isUsername("_.arinkoochak._",{validChars : ['@','_','$','#','.']}); //true

isUsername("_.arinkoochak._"); //true

isUsername("arian.koochak123",{validChars : ['@','_','$','#','.']}); //true

isUsername("arian.koochak123"); //true

isUsername("@eromche",{validChars : ['@','_','$','#','.']}); //true

isUsername("@eromche$_",{validChars : ['@','_','$','#','.']}); //true

isUsername("@eromche"); //false

isUsername("@eromche$_"); //false