UNPKG

sv-search-highlight

Version:

<p align="center"> <img style="text-align: center" src="https://angular-shortcode.web.app/assets/icons/logo-128.png"/> <h1 align="center">Angular Shortcode</h1> </p>

43 lines (37 loc) 1.01 kB
import { Pipe, NgModule } from '@angular/core'; class SvSearchHighlightPipe { transform(value, search) { if (!value) { return; } const re = new RegExp(search, 'gi'); const match = value.match(re); return search ? value.replace(re, `<mark>${match && match[0]}</mark>`) : value; } } SvSearchHighlightPipe.decorators = [ { type: Pipe, args: [{ name: 'svSearchHighlight' },] } ]; class SvSearchHighlightModule { } SvSearchHighlightModule.decorators = [ { type: NgModule, args: [{ declarations: [ SvSearchHighlightPipe ], imports: [], exports: [ SvSearchHighlightPipe ] },] } ]; /* * Public API Surface of sv-search-highlight */ /** * Generated bundle index. Do not edit. */ export { SvSearchHighlightModule, SvSearchHighlightPipe }; //# sourceMappingURL=sv-search-highlight.js.map