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 | 15x 15x 115x 15x 70x 15x 18x 18x | import type {CreateRegexMatcher} from '.';
import type {SlateTextNode, SlateElementNode} from './types';
const {isArray} = Array;
export const isTextNode = (node: unknown): node is SlateTextNode =>
!!node && typeof node === 'object' && typeof (node as SlateTextNode).text === 'string';
export const isElementNode = (node: unknown): node is SlateElementNode =>
!!node && typeof node === 'object' && isArray((node as SlateElementNode).children);
export const createMatcherDefault: CreateRegexMatcher = (pattern, ignoreCase) => {
const reg = new RegExp(pattern, ignoreCase ? 'i' : undefined);
return (value) => reg.test(value);
};
|