{"id":15028871,"url":"https://github.com/krisk/fuse","last_synced_at":"2026-05-22T05:20:44.552Z","repository":{"id":3416313,"uuid":"4467228","full_name":"krisk/Fuse","owner":"krisk","description":"Lightweight fuzzy-search, in JavaScript","archived":false,"fork":false,"pushed_at":"2025-03-08T19:48:57.000Z","size":9984,"stargazers_count":19514,"open_issues_count":12,"forks_count":796,"subscribers_count":137,"default_branch":"main","last_synced_at":"2025-09-06T04:01:58.843Z","etag":null,"topics":["bitap","javascript","lightweight-fuzzy-search","weighted-search"],"latest_commit_sha":null,"homepage":"https://fusejs.io/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/krisk.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"krisk","patreon":"krisk","custom":"https://www.paypal.com/paypalme2/kirorisk"}},"created_at":"2012-05-28T04:31:06.000Z","updated_at":"2025-09-05T22:29:47.000Z","dependencies_parsed_at":"2023-02-15T12:31:27.405Z","dependency_job_id":"a98ec3f0-22a9-488a-8152-c92eb3d2be2f","html_url":"https://github.com/krisk/Fuse","commit_stats":{"total_commits":739,"total_committers":86,"mean_commits":8.593023255813954,"dds":0.5507442489851151,"last_synced_commit":"43eebfaa35917217848958e0ccc811ca07026737"},"previous_names":[],"tags_count":115,"template":false,"template_full_name":null,"purl":"pkg:github/krisk/Fuse","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krisk%2FFuse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krisk%2FFuse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krisk%2FFuse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krisk%2FFuse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krisk","download_url":"https://codeload.github.com/krisk/Fuse/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krisk%2FFuse/sbom","scorecard":{"id":570081,"data":{"date":"2025-08-11","repo":{"name":"github.com/krisk/Fuse","commit":"fac16735655bedbee434a19855cdfc4a1dded5ac"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.7,"checks":[{"name":"Code-Review","score":1,"reason":"Found 3/28 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/nodejs.yml:1","Warn: no topLevel permission defined: .github/workflows/stale.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Pinned-Dependencies","score":2,"reason":"dependency not pinned by hash detected -- score normalized to 2","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/krisk/Fuse/nodejs.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/krisk/Fuse/nodejs.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/stale.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/krisk/Fuse/stale.yml/main?enable=pin","Info:   0 out of   3 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 5 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"25 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-ghr5-ch3p-vcr6","Warn: Project is vulnerable to: GHSA-67mh-4wv8-2f99","Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j","Warn: Project is vulnerable to: GHSA-x7hr-w5r2-h6wg","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-c24v-8rfc-w8vw","Warn: Project is vulnerable to: GHSA-8jhw-289h-jh2g","Warn: Project is vulnerable to: GHSA-64vr-g452-qvp3","Warn: Project is vulnerable to: GHSA-9cwx-2883-4wfx","Warn: Project is vulnerable to: GHSA-vg6x-rcgg-rjx6","Warn: Project is vulnerable to: GHSA-x574-m823-4x7w","Warn: Project is vulnerable to: GHSA-4r4m-qw57-chr8","Warn: Project is vulnerable to: GHSA-xcj6-pq6g-qj4x","Warn: Project is vulnerable to: GHSA-356w-63v5-8wf4","Warn: Project is vulnerable to: GHSA-859w-5945-r5v3","Warn: Project is vulnerable to: GHSA-92r3-m2mg-pj97"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-20T16:06:19.958Z","repository_id":3416313,"created_at":"2025-08-20T16:06:19.958Z","updated_at":"2025-08-20T16:06:19.958Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274358733,"owners_count":25270681,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-09T02:00:10.223Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitap","javascript","lightweight-fuzzy-search","weighted-search"],"created_at":"2024-09-24T20:09:15.054Z","updated_at":"2026-05-22T05:20:44.538Z","avatar_url":"https://github.com/krisk.png","language":"JavaScript","funding_links":["https://github.com/sponsors/krisk","https://patreon.com/krisk","https://www.paypal.com/paypalme2/kirorisk","https://patreon.com/fusejs","https://www.paypal.me/kirorisk"],"categories":["前端常用"],"sub_categories":[],"readme":"# Fuse.js\n\n![Node.js CI](https://github.com/krisk/Fuse/workflows/Node.js%20CI/badge.svg)\n[![Version](https://img.shields.io/npm/v/fuse.js.svg)](https://www.npmjs.com/package/fuse.js)\n[![Downloads](https://img.shields.io/npm/dm/fuse.js.svg)](https://npmcharts.com/compare/fuse.js?minimal=tru)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)\n[![Contributors](https://img.shields.io/github/contributors/krisk/fuse.svg)](https://github.com/krisk/Fuse/graphs/contributors)\n![License](https://img.shields.io/npm/l/fuse.js.svg)\n\nFuse.js is a lightweight, zero-dependency fuzzy-search library written in TypeScript. It works in the browser and on the server, and is designed for searching small-to-medium datasets on the client side where you can't rely on a dedicated search backend.\n\n## ✨ What's New: Token Search\n\nMulti-word fuzzy search with relevance ranking. Type `\"javascrpt paterns\"` and find `\"JavaScript Patterns\"` — typo tolerance, multiple words, and smart ranking all at once.\n\n```js\nconst fuse = new Fuse(docs, {\n  useTokenSearch: true,\n  keys: ['title', 'author', 'description']\n})\n\nfuse.search('javascrpt paterns')\n// → [{ item: { title: 'JavaScript Patterns', ... } }]\n```\n\nSee [Token Search](#token-search) below for details.\n\n## 🧪 Beta: Web Workers\n\nSearch large datasets without freezing the UI. `FuseWorker` splits your data across multiple Web Workers and searches in parallel — ~5x faster on 100K documents.\n\n```js\nimport { FuseWorker } from 'fuse.js/worker'\n\nconst fuse = new FuseWorker(docs, {\n  keys: ['title', 'author', 'description']\n})\n\nconst results = await fuse.search('query')\nfuse.terminate()\n```\n\nSame options and results as `Fuse` — just async. Function-valued options (`sortFn`, `getFn`, `keys[].getFn`) aren't supported because functions can't be transferred to a worker; everything else carries over. See the [Web Workers docs](https://fusejs.io/web-workers.html) for the interactive demo and full API.\n\n## Installation\n\n```bash\nnpm install fuse.js\n```\n\n```bash\nyarn add fuse.js\n```\n\nOr include directly via CDN:\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/fuse.js/dist/fuse.min.mjs\"\u003e\u003c/script\u003e\n```\n\n## Quick Start\n\n```js\nimport Fuse from 'fuse.js'\n\nconst books = [\n  { title: \"Old Man's War\", author: 'John Scalzi' },\n  { title: 'The Lock Artist', author: 'Steve Hamilton' },\n  { title: 'HTML5', author: 'Remy Sharp' },\n  { title: 'JavaScript: The Good Parts', author: 'Douglas Crockford' }\n]\n\nconst fuse = new Fuse(books, {\n  keys: ['title', 'author']\n})\n\nfuse.search('javscript')\n// → [{ item: { title: 'JavaScript: The Good Parts', ... }, ... }]\n```\n\n## Features\n\n### Fuzzy Search\n\nThe core of Fuse.js. Uses the [Bitap algorithm](https://en.wikipedia.org/wiki/Bitap_algorithm) for approximate string matching — handles typos, misspellings, and partial matches out of the box.\n\n```js\nfuse.search('javscript')\n// → [{ item: { title: 'JavaScript: The Good Parts', author: 'Douglas Crockford' } }]\n```\n\n### Weighted Keys\n\nSearch across multiple fields with different importance levels. Title matches can rank higher than description matches.\n\n```js\nconst fuse = new Fuse(docs, {\n  keys: [\n    { name: 'title', weight: 2 },\n    { name: 'description', weight: 1 }\n  ]\n})\n```\n\n### Extended Search\n\nUse operators for precise control: exact match (`=`), prefix (`^`), suffix (`!`), and more. Enable with `useExtendedSearch: true`.\n\n```js\nconst fuse = new Fuse(list, {\n  useExtendedSearch: true,\n  keys: ['title']\n})\n\nfuse.search('=exact match')   // exact match\nfuse.search('^prefix')        // starts with\nfuse.search('!term')          // does not include\n```\n\n### Token Search\n\nSplits multi-word queries into individual terms, fuzzy-matches each independently, and ranks results using BM25-style IDF weighting. Enable with `useTokenSearch: true`.\n\n```js\nconst fuse = new Fuse(docs, {\n  useTokenSearch: true,\n  keys: ['title', 'body']\n})\n\nfuse.search('express midleware rout')\n// Finds \"Express Middleware\" and \"Express Routing Guide\" despite typos\n```\n\n- **Typo tolerance per word** — each term is fuzzy-matched independently\n- **Relevance ranking** — rare terms are weighted higher than common ones\n- **Word order independent** — `\"patterns javascript\"` and `\"javascript patterns\"` return identical results\n- **No query length limit** — long multi-word queries work naturally since each term is searched separately\n- **AND or OR** — `tokenMatch: 'all'` returns only records matching *every* word (filtering); the default `'any'` matches any word\n\nAvailable in the full build. See [TOKEN_SEARCH.md](TOKEN_SEARCH.md) for details and performance benchmarks.\n\n### Logical Search\n\nCombine conditions with `$and` and `$or` for complex queries. Available in the full build.\n\n```js\nfuse.search({\n  $and: [\n    { title: 'javascript' },\n    { author: 'crockford' }\n  ]\n})\n```\n\n### Match Highlighting\n\nGet character-level match indices for highlighting search results in your UI.\n\n```js\nconst fuse = new Fuse(list, {\n  includeMatches: true,\n  keys: ['title']\n})\n\nconst result = fuse.search('javscript')\n// result[0].matches[0].indices → [[0, 9]]\n```\n\n### Single String Matching\n\nUse `Fuse.match()` to fuzzy-match a pattern against a single string without creating an index. Useful for one-off comparisons or custom filtering.\n\n```js\nconst result = Fuse.match('javscript', 'JavaScript: The Good Parts')\n// → { isMatch: true, score: 0.04, indices: [[0, 9]] }\n```\n\n`Fuse.match()` does **not** support `useTokenSearch` — token search requires corpus-level statistics (`df`, `fieldCount`) that a one-off string comparison can't provide. Passing `useTokenSearch: true` throws an explicit error. Use `new Fuse(docs, { useTokenSearch: true }).search(query)` for token-search behavior.\n\n### Dynamic Collections\n\nAdd and remove documents from a live index without rebuilding.\n\n```js\nfuse.add({ title: 'New Book', author: 'New Author' })\nfuse.remove((doc) =\u003e doc.title === 'Old Book')\n```\n\n## Builds\n\nFuse.js ships in two variants:\n\n| Build | Includes | Min + gzip |\n|---|---|---|\n| **Full** | Fuzzy + Extended + Logical + Token search | ~8.6 kB |\n| **Basic** | Fuzzy search only | ~6.8 kB |\n\nUse the basic build if you only need fuzzy search and want the smallest bundle size.\n\n## Documentation\n\nFor the full API reference, configuration options, scoring theory, and interactive demos, visit **[fusejs.io](https://fusejs.io)**.\n\n## Official ports\n\n- **[fuse-swift](https://github.com/krisk/fuse-swift)**: Swift port for iOS, macOS, tvOS, watchOS, visionOS, and Linux. Byte-equivalent results, idiomatic Swift API, syncs with each upstream release. Currently in 2.0.0-rc.1.\n\n## Supporting Fuse.js\n\n- [Become a backer or sponsor on **GitHub**](https://github.com/sponsors/krisk)\n- [Become a backer or sponsor on **Patreon**](https://patreon.com/fusejs)\n- [One-time donation via **PayPal**](https://www.paypal.me/kirorisk)\n\n## Develop\n\nSee [DEVELOPERS.md](DEVELOPERS.md) for setup, scripts, and project structure.\n\n## Contribute\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on issues and pull requests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrisk%2Ffuse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrisk%2Ffuse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrisk%2Ffuse/lists"}