UNPKG

@shhhplus/react-text-matcher

Version:

A React component that matches text using specified rules, supporting string and regular expressions.

13 lines (12 loc) 463 B
import { FC, ReactNode } from 'react'; import createTextMatcher from '@shhhplus/text-matcher'; type TParameters = Parameters<typeof createTextMatcher>; type TextMatcher = ReturnType<typeof createTextMatcher>; export type TMResult = ReturnType<TextMatcher['exec']>; type TextMatcherProps = { text: string; rules: TParameters[0]; children: (result: TMResult) => ReactNode; }; declare const TextMatcher: FC<TextMatcherProps>; export default TextMatcher;