@scalar/api-client
Version:
the open source API testing client
19 lines (18 loc) • 577 B
JavaScript
import { computed as n, toValue as o, ref as c } from "vue";
import { createFuseInstance as a } from "../helpers/create-fuse-instance.js";
import { createSearchIndex as l } from "../helpers/create-search-index.js";
const i = 25, h = (s) => {
const u = n(() => {
const t = a();
return t.setCollection(l(o(s))), t;
}), e = c("");
return {
results: n(() => e.value.length !== 0 ? u.value.search(e.value, {
limit: i
}).flatMap((r) => r.item.entry.type !== "operation" ? [] : r.item.entry) : null),
query: e
};
};
export {
h as useSearchIndex
};