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 | 60x 60x 1290x 60x 60x 60x 54x 54x 54x 54x 264x 264x 264x 264x 264x 54x | import type {SliceTypeSteps} from '../slice'; import type {CharPredicate} from './types'; const LETTER_REGEX = /(\p{Letter}|\d|_)/u; const WHITESPACE_REGEX = /\s/; export const isLetter: CharPredicate<string> = (char: string) => LETTER_REGEX.test(char[0]); export const isWhitespace: CharPredicate<string> = (char: string) => WHITESPACE_REGEX.test(char[0]); export const isPunctuation: CharPredicate<string> = (char: string) => !isLetter(char) && !isWhitespace(char); /** * Compares two block slice types, ignores tag discriminants. */ export const stepsEqual = (a: SliceTypeSteps, b: SliceTypeSteps): boolean => { const lenA = a.length; const lenB = b.length; Iif (lenA !== lenB) return false; for (let i = 0; i < lenA; i++) { const stepA = a[i]; const stepB = b[i]; const tagA = Array.isArray(stepA) ? stepA[0] : stepA; const tagB = Array.isArray(stepB) ? stepB[0] : stepB; Iif (tagA !== tagB) return false; } return true; }; |