mirror of
https://github.com/pheralb/svgl.git
synced 2025-12-29 08:01:36 +08:00
24 lines
608 B
TypeScript
24 lines
608 B
TypeScript
import type { Extension } from "@/types/extensions";
|
|
import type { iSVG } from "@/types/svg";
|
|
import Fuse from "fuse.js";
|
|
|
|
export const searchSvgsWithFuse = (svgsData: iSVG[]) => {
|
|
return new Fuse<iSVG>(svgsData, {
|
|
keys: ["title"],
|
|
threshold: 0.35,
|
|
ignoreLocation: true,
|
|
isCaseSensitive: false,
|
|
shouldSort: true,
|
|
});
|
|
};
|
|
|
|
export const searchExtensionsWithFuse = (extensionsData: Extension[]) => {
|
|
return new Fuse<Extension>(extensionsData, {
|
|
keys: ["name", "description"],
|
|
threshold: 0.35,
|
|
ignoreLocation: true,
|
|
isCaseSensitive: false,
|
|
shouldSort: true,
|
|
});
|
|
};
|