Skip to content

Instantly share code, notes, and snippets.

View pandeyAmit4's full-sized avatar

Amit Pandey pandeyAmit4

View GitHub Profile
@evenfrost
evenfrost / highlight.ts
Last active March 3, 2025 11:45
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;