Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(child: React.ReactElement, index: number): boolean => {
if (child.props[this.props.typeAheadPropertyKey] === undefined) {
return false;
}
if (
startsWith(
child.props[this.props.typeAheadPropertyKey].toLowerCase(),
this.typeAheadString
)
) {
matchIndex = index;
return true;
}
}
);
private defaultDisplayFormatter = (
displayString: string,
searchString: string
): React.ReactNode => {
if (
!isNil(displayString) &&
!isNil(searchString) &&
startsWith(displayString.toLowerCase(), searchString.toLowerCase())
) {
return (
<span>
<b>{displayString.substring(0, searchString.length)}</b>
{displayString.substring(searchString.length, displayString.length)}
</span>
);
}
return displayString;
};
}