All files / validator string.ts

100% Statements 10/10
100% Branches 0/0
100% Functions 6/6
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16            1x 5x   4x 4x 4x 4x   1x  
import { IValidator } from '../interfaces/IValidator';
 
/**
 * tests a given test string to match a regular expression
 * @param match {expression}
 */
const match = (matcher: RegExp): IValidator => (test: string): boolean =>
	matcher.test(test);
 
const lowerCase = (): IValidator => (test: string): boolean =>
	test === test.toLowerCase();
const upperCase = (): IValidator => (test: string): boolean =>
	test === test.toUpperCase();
 
export default { match, lowerCase, upperCase };