chkchars
v1.2.0
Published
You can use this package to verify whether there are caps or symbols or numbers in a string. This will will be very useful if you are making a signup system there you can check the validity of the password, username etc. Or you can use this package in any
Downloads
13
Readme
chkchar
This is a utility package. You can use this to check the availibility of capitals, symbols or numbers in a string and also seperate a string into chuncks.
Methods
- caps(phrase)
- numbers(phrase)
- symbols(phrase)
- fullCount(phrase)
- isEnglish(phrase)
- allNums(phrase)
- allSymbols(phrase)
- allCaps(phrase)
- sliceToChunks(phrase, number)
Installation
npm i chkchars
1.caps(phrase)
Checks if there are capital english letters in a given string. phrase: string
Output format
{
status: true / false --- true === contains false === does not contain
count: number --- number of caps in the given phrase
fount: array --- all the caps found in the given phrase (no duplicates)
}
2.numbers(phrase)
Checks if there are numbers in a given string. phrase: string
Output format
{
status: true / false --- true === contains false === does not contain
count: number --- number of numbers in the given phrase
fount: array --- all the numbers found in the given phrase (no duplicates)
}
3.symbols(phrase)
Checks if there are symbols in a given string. phrase: string
Output format
{
status: true / false --- true === contains false === does not contain
count: number --- number of symbols in the given phrase
fount: array --- all the symbols found in the given phrase (no duplicates)
}
4.fullCount(phrase)
Returns the number of occurences of all caps, numbers and symbols
Output format
{
caps: --- number of english capital letters found.
numbers: --- number of numbers found.
symbols: --- number of symbols found.
}
5.isEnglish(phrase)
Checks if the given string is composed only with english letters.
If all the characters are english letters
true
If at least one of them not a english letter
false
6.allNums(phrase)
Checks if the given string is composed only with numbers.
If all the characters are numbers
true
If at least one of them not a number
false
7.allSymbols(phrase)
Checks if the given string is composed only with symbols.
If all the characters are symbols
true
If at least one of them not a symbol
false
8.allCaps(phrase)
Checks if the given string is composed only with english capital letters.
If all the characters are english capital letters
true
If at least one of them not a english capital letter
false
9.sliceToChunks(phrase, number)
Slices a given string into chuncks of length of given "number" parameter. Remember to provide a string of length that is perfectly divided by the "number" parameter.
This method returns a array of strings.
If phrase === "dictionary" number === 5
output
["dicti", "onary"]