lucid-ui
Version:
A UI component library from AppNexus.
29 lines (28 loc) • 876 B
TypeScript
import React from 'react';
/**
* Performs a regex search and returns a partitioning around the matching substring: [pre, match, post]
*
* @param text: string to search
* @param pattern: RegExp patten
* @param length (optional): provide a max length for the matching substring
*
* @return string[]
*/
export declare function partitionText(text: string, pattern: RegExp, length?: number): string[];
/**
* Returns the combined text of all descendant strings
*
* @param node: a component props object
*
* @return string
*/
export declare function getCombinedChildText(node: React.PropsWithChildren<{}> | null): string;
/**
* Perform a regex search on all text found in a component's descendants
*
* @param text
* @param node
*
* @return boolean
*/
export declare function propsSearch(text?: string | null, node?: React.PropsWithChildren<{}> | null): boolean;