UNPKG

@scalar/api-client

Version:

the open source API testing client

25 lines (24 loc) 606 B
import { computed as n, toValue as l, ref as a } from "vue"; import { createFuseInstance as i } from "../helpers/create-fuse-instance.js"; import { createSearchIndex as m } from "../helpers/create-search-index.js"; const s = 25; function h(o) { const r = n(() => { const t = i(); return t.setCollection(m(l(o))), t; }), e = a(""); return { results: n(() => e.value.length !== 0 ? r.value.search(e.value, { limit: s }) : r.value._docs.slice(0, s).map( (c, u) => ({ item: c, refIndex: u }) )), query: e }; } export { h as useSearchIndex };