react-highlighter-ts
Version:
a TypeScript rewrite of the package react-highlighter
22 lines (21 loc) • 971 B
TypeScript
import { ReactNode } from "react";
import { HighlightProps } from "./highlight.model";
/**
* Get the indexes of the first and last characters of the matched string.
*/
export declare function getMatchBoundaries(subject: string, search: RegExp): {
first: number;
last: number;
} | undefined;
/**
* Get the search prop, but always in the form of a regular expression. Use
* this as a proxy to search for consistency.
*/
export declare function getSearch(props: HighlightProps): RegExp;
export declare const removeDiacritics: (s: string, blacklist?: string | undefined) => string;
export declare type MapFunction = (child: ReactNode, index?: number, children?: readonly ReactNode[]) => ReactNode;
/**
* Borrowed from https://github.com/fernandopasik/react-children-utilities/blob/9720f5fcc3f7cb46fa81909780d97356c201c041/src/lib/deepMap.ts
*/
export declare const deepMap: (children: ReactNode, deepMapFn: MapFunction) => ReactNode[];
export default deepMap;