Micro check library providing comprehensive type checking and validation operations across different JavaScript environments
—
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
String-specific validation including case checking, content analysis, and format validation.
Checks if the given string is all uppercase.
/**
* Checks if the given string is UPPERCASE
* @param value - String to check
* @returns True if string is all uppercase
* Interfaces: not, all, any
*/
function upperCase(value: string): boolean;Usage Example:
is.upperCase('YEAP'); // true
is.upperCase('nope'); // false
is.not.upperCase('Nope'); // true
is.all.upperCase('YEAP', 'nope'); // false
is.any.upperCase('YEAP', 'nope'); // trueChecks if the given string is all lowercase.
/**
* Checks if the given string is lowercase
* @param value - String to check
* @returns True if string is all lowercase
* Interfaces: not, all, any
*/
function lowerCase(value: string): boolean;Usage Example:
is.lowerCase('yeap'); // true
is.lowerCase('NOPE'); // false
is.not.lowerCase('Nope'); // true
is.all.lowerCase('yeap', 'NOPE'); // false
is.any.lowerCase('yeap', 'NOPE'); // trueChecks if the given string is capitalized (each word starts with uppercase).
/**
* Checks if the given string is capitalized
* @param value - String to check
* @returns True if string is capitalized
* Interfaces: not, all, any
*/
function capitalized(value: string): boolean;Usage Example:
is.capitalized('Yeap'); // true
is.capitalized('nope'); // false
is.not.capitalized('nope not capitalized'); // true
is.all.capitalized('Yeap', 'All', 'Capitalized'); // true
is.any.capitalized('Yeap', 'some', 'Capitalized'); // trueChecks if the given string contains a substring.
/**
* Checks if the given string contains a substring
* @param string - String to search in
* @param target - Substring to search for
* @returns True if string contains target
* Interfaces: not
*/
function include(string: string, target: string): boolean;Usage Example:
is.include('Some text goes here', 'text'); // true
is.include('test', 'text'); // false
is.not.include('test', 'text'); // trueChecks if the given string starts with a substring.
/**
* Checks if the given string starts with substring
* @param string - String to check
* @param target - Substring to check for at start
* @returns True if string starts with target
* Interfaces: not
*/
function startWith(string: string, target: string): boolean;Usage Example:
is.startWith('yeap', 'ye'); // true
is.startWith('nope', 'ye'); // false
is.not.startWith('nope not that', 'not'); // trueChecks if the given string ends with a substring.
/**
* Checks if the given string ends with substring
* @param string - String to check
* @param target - Substring to check for at end
* @returns True if string ends with target
* Interfaces: not
*/
function endWith(string: string, target: string): boolean;Usage Example:
is.endWith('yeap', 'ap'); // true
is.endWith('nope', 'no'); // false
is.not.endWith('nope not that', 'not'); // true
is.endWith('yeap that one', 'one'); // trueChecks if the given string is a palindrome (reads the same forwards and backwards).
/**
* Checks if the given string is palindrome
* @param value - String to check
* @returns True if string is palindrome
* Interfaces: not, all, any
*/
function palindrome(value: string): boolean;Usage Example:
is.palindrome('testset'); // true
is.palindrome('A man, a plan, a canal - Panama!'); // true
is.palindrome('nope'); // false
is.not.palindrome('nope not palindrome'); // true
is.all.palindrome('testset', 'tt'); // true
is.any.palindrome('Yeap', 'some', 'testset'); // true