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 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | 1x 1x 9x 10x 1x 9x 9x 3x 6x 1x 9x 5x 4x 1x 4x 1x 3x 3x | import { camelCase } from "lodash-es"; /** * Builds a string from a format specifier and replacement parameters. */ export function format(formatSpecifier: string, ...parameters: string[]): string { return formatSpecifier.replace(/{(\d+)}/g, function(match: string, index: number): any { if (index >= parameters.length) { return match; } const value: string = parameters[index]; if ((typeof value !== "number") && !value) { return ""; } return value; }); } /** * Check to see if one string starts with another */ export function startsWith(stringToSearch: string, searchFor: string, position: number = 0): boolean { if (!stringToSearch || !searchFor) { return false; } return stringToSearch.substr(position, searchFor.length) === searchFor; } /** * @name - isNullOrWhiteSpace * Determines if the specified string is undefined, null, empty, or whitespace. * True if the value is undefined, null, empty, or whitespace, otherwise false. */ export function isNullOrWhiteSpace(value: string): boolean { return (!value) || (!value.trim()); } /** * Converts a string to Pascal Case */ export function pascalCase(value: string): string { const camelCased: string = camelCase(value); return `${camelCased.charAt(0).toUpperCase()}${camelCased.slice(1)}`; } |