Skip to content

Instantly share code, notes, and snippets.

View pandeyAmit4's full-sized avatar

Amit Pandey pandeyAmit4

  • TCS
  • Mumbai
View GitHub Profile
@evenfrost
evenfrost / highlight.ts
Last active April 20, 2024 16:37
Fuse.js with highlight
const highlight = (fuseSearchResult: any, highlightClassName: string = 'highlight') => {
const set = (obj: object, path: string, value: any) => {
const pathValue = path.split('.');
let i;
for (i = 0; i < pathValue.length - 1; i++) {
obj = obj[pathValue[i]];
}
obj[pathValue[i]] = value;