String Checkers
isCamelCase
Checks if a string follows the camelCase format.
Function Signature
function isCamelCase(str: string): boolean;
Parameters
str
: The string to check.
Returns
Returns true
if the string is in camelCase, otherwise false
.
Example
isCamelCase('camelCase'); // true
isCamelCase('CamelCase'); // false
isPascalCase
Checks if a string follows the PascalCase format.
Function Signature
function isPascalCase(str: string): boolean;
Parameters
str
: The string to check.
Returns
Returns true
if the string is in PascalCase, otherwise false
.
Example
isPascalCase('PascalCase'); // true
isPascalCase('pascalCase'); // false
isSnakeCase
Checks if a string follows the snake_case format.
Function Signature
function isSnakeCase(str: string): boolean;
Parameters
str
: The string to check.
Returns
Returns true
if the string is in snake_case, otherwise false
.
Example
isSnakeCase('snake_case'); // true
isSnakeCase('Snake_Case'); // false
isKebabCase
Checks if a string follows the kebab-case format.
Function Signature
function isKebabCase(str: string): boolean;
Parameters
str
: The string to check.
Returns
Returns true
if the string is in kebab-case, otherwise false
.
Example
isKebabCase('kebab-case'); // true
isKebabCase('Kebab-Case'); // false
isPalindrome
Checks if a string is a palindrome (reads the same backward as forward, ignoring case and non-alphanumeric characters).
Function Signature
const isPalindrome: (input: string) => boolean;
Parameters
input
: The string to check.
Returns
Returns true
if the string is a palindrome, otherwise false
.
Example
isPalindrome('Racecar'); // true
isPalindrome('A man, a plan, a canal: Panama'); // true
isPalindrome('hello'); // false
Dependencies
- Uses
reverseString
internally to perform the reversal comparison.
isEmojiOnly
Checks if a string contains only emojis.
Function Signature
function isEmojiOnly(str: string): boolean;
Parameters
str
: The input string to check.
Returns
Returns true
if the string contains only emojis, otherwise false
.
Example
isEmojiOnly('🎉🔥'); // true
isEmojiOnly('🎉 text'); // false
isEmojiOnly(''); // false
Notes
- This uses the Unicode
\p{Emoji}
property from RegExp Unicode property escapes. - The
u
flag is required for proper Unicode handling.
Would you like to proceed with more emoji-related utilities or move to a different category?