* // Individual module import
* import { SearchHighlightPipeModule } from 'patternfly-ng/pipe';
* // Or
* import { SearchHighlightPipeModule } from 'patternfly-ng';
*
* @NgModule({
* imports: [SearchHighlightPipeModule,...]
* })
* export class AppModule(){}
*
*/
@Pipe({ name: 'searchHighlight' })
export class SearchHighlightPipe implements PipeTransform {
/**
* Transform the substring matching the given search
*
* @param {string} val The string to highlight
* @param {string} search The text to search for
* @returns {any} The given string with highlighted text
*/
transform(val: string, search: string): any {
if (search !== undefined && search.length > 0) {
let lowerVal = val.toLowerCase();
search = search.toLowerCase();
if (!lowerVal) return '';
else return this.convertToOriginal(lowerVal.split(search).join('