├── .eslintrc.cjs ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ ├── config.yml │ ├── docs_bug.yml │ ├── feature_request.yml │ └── support_request.yml └── workflows │ ├── nodejs.yml │ └── stale.yml ├── .gitignore ├── .husky ├── commit-msg └── pre-commit ├── .npmrc ├── .prettierignore ├── .prettierrc.cjs ├── CHANGELOG.md ├── CONTRIBUTING.md ├── DEVELOPERS.md ├── LICENSE ├── README.md ├── babel.config.json ├── backers.md ├── dist ├── fuse.basic.cjs ├── fuse.basic.js ├── fuse.basic.min.cjs ├── fuse.basic.min.js ├── fuse.basic.min.mjs ├── fuse.basic.mjs ├── fuse.cjs ├── fuse.d.ts ├── fuse.js ├── fuse.min.cjs ├── fuse.min.js ├── fuse.min.mjs └── fuse.mjs ├── docs ├── .vuepress │ ├── client.ts │ ├── components │ │ ├── Demo │ │ │ ├── Demo.vue │ │ │ ├── MonacoEditor.vue │ │ │ └── books.ts │ │ ├── Donate │ │ │ └── Donate.vue │ │ ├── Jobs │ │ │ ├── Jobs.vue │ │ │ └── jobs.ts │ │ ├── Sponsors │ │ │ └── Sponsors.vue │ │ ├── Stories │ │ │ └── Stories.vue │ │ ├── SuspensefulDemo │ │ │ └── SuspensefulDemo.vue │ │ ├── Team │ │ │ └── Team.vue │ │ ├── TwitterFollow │ │ │ ├── TwitterBird.vue │ │ │ └── TwitterFollow.vue │ │ └── Version │ │ │ ├── Version.vue │ │ │ └── module-declaration.d.ts │ ├── config.ts │ ├── layouts │ │ ├── Layout.vue │ │ └── components │ │ │ ├── AdUnit.vue │ │ │ ├── BuySellAds.vue │ │ │ └── CarbonAds.vue │ ├── public │ │ ├── assets │ │ │ └── img │ │ │ │ ├── email.png │ │ │ │ ├── github-black.svg │ │ │ │ ├── github-white.svg │ │ │ │ ├── logo.png │ │ │ │ ├── paypal.png │ │ │ │ ├── products │ │ │ │ ├── notebag@2x.png │ │ │ │ └── notejoy@2x.png │ │ │ │ ├── sponsors │ │ │ │ ├── bairesdev.png │ │ │ │ ├── litslink.svg │ │ │ │ ├── quadratica.png │ │ │ │ └── worksome.svg │ │ │ │ ├── twitter-black.svg │ │ │ │ └── twitter-white.svg │ │ ├── favicon.ico │ │ ├── icons │ │ │ ├── android-icon-144x144.png │ │ │ ├── android-icon-192x192.png │ │ │ ├── android-icon-36x36.png │ │ │ ├── android-icon-48x48.png │ │ │ ├── android-icon-72x72.png │ │ │ ├── android-icon-96x96.png │ │ │ ├── apple-icon-114x114.png │ │ │ ├── apple-icon-120x120.png │ │ │ ├── apple-icon-144x144.png │ │ │ ├── apple-icon-152x152.png │ │ │ ├── apple-icon-180x180.png │ │ │ ├── apple-icon-57x57.png │ │ │ ├── apple-icon-60x60.png │ │ │ ├── apple-icon-72x72.png │ │ │ ├── apple-icon-76x76.png │ │ │ ├── apple-icon-precomposed.png │ │ │ ├── apple-icon.png │ │ │ ├── browserconfig.xml │ │ │ ├── favicon-16x16.png │ │ │ ├── favicon-32x32.png │ │ │ ├── favicon-96x96.png │ │ │ ├── favicon.ico │ │ │ ├── favicon.png │ │ │ ├── ms-icon-144x144.png │ │ │ ├── ms-icon-150x150.png │ │ │ ├── ms-icon-310x310.png │ │ │ └── ms-icon-70x70.png │ │ └── manifest.webmanifest │ ├── styles │ │ ├── grid.css │ │ └── index.scss │ └── tsconfig.json ├── README.md ├── api │ ├── README.md │ ├── config.md │ ├── indexing.md │ ├── methods.md │ ├── options.md │ └── query.md ├── concepts │ └── scoring-theory.md ├── demo.md ├── donate.md ├── examples.md ├── getting-started │ ├── different-builds.md │ └── installation.md ├── jobs.md ├── stories.md ├── team.md └── test.md ├── package-lock.json ├── package.json ├── scripts ├── build.main.cjs ├── bump-docs.cjs ├── config-types.cjs ├── configs.cjs ├── deploy-docs.sh └── release.sh ├── src ├── core │ ├── computeScore.js │ ├── config.js │ ├── errorMessages.js │ ├── format.js │ ├── index.js │ ├── queryParser.js │ └── register.js ├── entry.js ├── helpers │ ├── diacritics.js │ ├── get.js │ └── types.js ├── index.d.ts ├── search │ ├── bitap │ │ ├── computeScore.js │ │ ├── constants.js │ │ ├── convertMaskToIndices.js │ │ ├── createPatternAlphabet.js │ │ ├── index.js │ │ └── search.js │ ├── extended │ │ ├── BaseMatch.js │ │ ├── ExactMatch.js │ │ ├── FuzzyMatch.js │ │ ├── IncludeMatch.js │ │ ├── InverseExactMatch.js │ │ ├── InversePrefixExactMatch.js │ │ ├── InverseSuffixExactMatch.js │ │ ├── PrefixExactMatch.js │ │ ├── SuffixExactMatch.js │ │ ├── index.js │ │ └── parseQuery.js │ └── index.js ├── tools │ ├── FuseIndex.js │ ├── KeyStore.js │ └── norm.js ├── transform │ ├── index.js │ ├── transformMatches.js │ └── transformScore.js └── tsconfig.json ├── test ├── __snapshots__ │ ├── extended-search.test.js.snap │ ├── fuzzy-search.test.js.snap │ └── logical-search.test.js.snap ├── extended-search.test.js ├── feature-flags.test.js ├── fixtures │ ├── books.json │ ├── pokedex.js │ ├── pokedex.ts │ ├── types.js │ └── types.ts ├── fuzzy-search.test.js ├── indexing.test.js ├── logical-search.test.js ├── scoring.test.js ├── tsconfig.json └── typings.test.ts ├── tsconfig.base.json └── vitest.config.ts /.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | parser: '@babel/eslint-parser', 4 | parserOptions: { 5 | ecmaVersion: 8, 6 | ecmaFeatures: { 7 | experimentalObjectRestSpread: true 8 | }, 9 | sourceType: 'module' 10 | }, 11 | env: { 12 | es6: true, 13 | node: true, 14 | browser: true, 15 | jest: true 16 | }, 17 | extends: ['eslint:recommended', 'prettier'], 18 | rules: { 19 | 'no-console': process.env.NODE_ENV !== 'production' ? 0 : 2, 20 | 'no-useless-escape': 0, 21 | 'no-empty': 0 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: krisk 2 | patreon: krisk 3 | custom: 'https://www.paypal.com/paypalme2/kirorisk' 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: Bug Report 2 | description: Report a bug in Fuse.js. 3 | labels: ['bug'] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | Thanks for taking the time to fill out this bug report! 9 | - type: checkboxes 10 | id: new-bug 11 | attributes: 12 | label: Is there an existing issue for this? 13 | description: Please search to see if an issue already exists for the bug you encountered. 14 | options: 15 | - label: I have searched the existing issues 16 | required: true 17 | - type: textarea 18 | id: bug-description 19 | attributes: 20 | label: Description of the bug 21 | description: Tell us what bug you encountered and what should have happened 22 | validations: 23 | required: true 24 | - type: dropdown 25 | id: fuse-version 26 | attributes: 27 | label: The Fuse.js version where this bug is happening. 28 | options: 29 | - '6.6.2' 30 | - '6.6.1' 31 | - '6.6.0' 32 | - '6.5.3' 33 | - '6.5.2' 34 | - '6.5.1' 35 | - '6.4.6' 36 | - '6.4.5' 37 | - '6.4.4' 38 | - '6.4.3' 39 | - '6.4.2' 40 | - '6.4.1' 41 | - '6.4.0' 42 | - '6.3.1' 43 | - '6.3.0' 44 | - '6.2.1' 45 | - '6.2.0' 46 | - '6.0.0' 47 | - '5.2.1' 48 | - '2.2.0' 49 | - '2.0.0' 50 | - '1.2.0' 51 | - '1.1.0' 52 | - '1.0.0' 53 | - '1.0.1' 54 | - 'Other (please specify in description)' 55 | validations: 56 | required: true 57 | - type: checkboxes 58 | id: regression-bug 59 | attributes: 60 | label: Is this a regression? 61 | description: Did this behavior use to work in the previous version? 62 | options: 63 | - label: This is a regression bug 64 | required: false 65 | - type: dropdown 66 | id: regression-version 67 | attributes: 68 | label: Which version did this behavior use to work in? 69 | description: In case you checked the regression bug checkbox, please provide the version in which this bug was not present. 70 | options: 71 | - '6.6.2' 72 | - '6.6.1' 73 | - '6.6.0' 74 | - '6.5.3' 75 | - '6.5.2' 76 | - '6.5.1' 77 | - '6.4.6' 78 | - '6.4.5' 79 | - '6.4.4' 80 | - '6.4.3' 81 | - '6.4.2' 82 | - '6.4.1' 83 | - '6.4.0' 84 | - '6.3.1' 85 | - '6.3.0' 86 | - '6.2.1' 87 | - '6.2.0' 88 | - '6.0.0' 89 | - '5.2.1' 90 | - '2.2.0' 91 | - '2.0.0' 92 | - '1.2.0' 93 | - '1.1.0' 94 | - '1.0.0' 95 | - '1.0.1' 96 | - 'Other (please specify in description)' 97 | - type: textarea 98 | id: steps-to-reproduce 99 | attributes: 100 | label: Steps To Reproduce 101 | description: Steps to reproduce the behavior. 102 | placeholder: | 103 | Please tell us how to reproduce this bug, for example: 104 | 1. Write '...' 105 | 2. Click on '...' 106 | 3. See error 107 | validations: 108 | required: true 109 | - type: textarea 110 | id: expected-behavior 111 | attributes: 112 | label: Expected behavior 113 | description: What should be the expected behavior. 114 | placeholder: A clear and concise description of what you expected to happen. 115 | validations: 116 | required: true 117 | - type: textarea 118 | id: screenshots 119 | attributes: 120 | label: Screenshots 121 | description: If applicable, add screenshots to help explain your problem. 122 | placeholder: Paste your screenshots here. 123 | - type: textarea 124 | id: additional-context 125 | attributes: 126 | label: Additional context 127 | description: Do you want to share any additional context about this bug? 128 | placeholder: Add any other context about the problem here. 129 | - type: markdown 130 | attributes: 131 | value: | 132 | Love Fuse.js? Please consider supporting: 133 | 👉 https://github.com/sponsors/krisk 134 | 👉 https://www.patreon.com/krisk 135 | 👉 https://www.paypal.com/paypalme2/kirorisk 136 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/docs_bug.yml: -------------------------------------------------------------------------------- 1 | name: Docs on fusejs.io 2 | description: Report an issue in Fuse.js documentation or fusejs.io 3 | labels: ['docs'] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | Thanks for taking the time to fill out this bug report! 9 | - type: checkboxes 10 | id: new-bug 11 | attributes: 12 | label: Is there an existing issue for this? 13 | description: Please search to see if an issue already exists for the bug you encountered. 14 | options: 15 | - label: I have searched the existing issues 16 | required: true 17 | - type: textarea 18 | id: bug-description 19 | attributes: 20 | label: Description of the bug 21 | description: Tell us what bug you encountered and what should have happened 22 | validations: 23 | required: true 24 | - type: textarea 25 | id: screenshots 26 | attributes: 27 | label: Screenshots 28 | description: If applicable, add screenshots to help explain your problem. 29 | placeholder: Paste your screenshots here. 30 | - type: markdown 31 | attributes: 32 | value: | 33 | Love Fuse.js? Please consider supporting: 34 | 👉 https://github.com/sponsors/krisk 35 | 👉 https://www.patreon.com/krisk 36 | 👉 https://www.paypal.com/paypalme2/kirorisk 37 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.yml: -------------------------------------------------------------------------------- 1 | name: Feature request 2 | description: Suggest a feature for Fuse.js. 3 | labels: ['feature'] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: Thank you for suggesting this feature! The more information you provide, the more likely it is that it will be picked up. 8 | - type: checkboxes 9 | id: new-feature 10 | attributes: 11 | label: Is there an existing issue or pull request for this? 12 | description: Please search to see if an issue or pull request already exists for the feature you desire. 13 | options: 14 | - label: I have searched the existing issues and pull requests 15 | required: true 16 | - type: textarea 17 | id: feature-description 18 | attributes: 19 | label: Feature description 20 | description: Is your feature request related to a problem? Please describe. 21 | placeholder: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 22 | validations: 23 | required: true 24 | - type: textarea 25 | id: desired-solution 26 | attributes: 27 | label: Desired solution 28 | description: Describe the solution you'd like 29 | placeholder: A clear and concise description of what you want to happen. 30 | validations: 31 | required: true 32 | - type: textarea 33 | id: alternatives-considered 34 | attributes: 35 | label: Alternatives considered 36 | description: Describe alternatives you've considered 37 | placeholder: A clear and concise description of any alternative solutions or features you've considered. 38 | validations: 39 | required: true 40 | - type: textarea 41 | id: additional-context 42 | attributes: 43 | label: Additional context 44 | description: Do you want to share any additional context about this bug? 45 | placeholder: Add any other context about the problem here. 46 | - type: markdown 47 | attributes: 48 | value: | 49 | Love Fuse.js? Please consider supporting: 50 | 👉 https://github.com/sponsors/krisk 51 | 👉 https://www.patreon.com/krisk 52 | 👉 https://www.paypal.com/paypalme2/kirorisk 53 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/support_request.yml: -------------------------------------------------------------------------------- 1 | name: Support request 2 | description: Questions and requests for support. 3 | labels: ['question'] 4 | body: 5 | - type: checkboxes 6 | id: new-question 7 | attributes: 8 | label: Is there an existing issue for this? 9 | description: Please search to see if an issue already exists for the question you want answered. 10 | options: 11 | - label: I have searched the existing issues 12 | required: true 13 | - type: textarea 14 | id: question-description 15 | attributes: 16 | label: Your question 17 | validations: 18 | required: true 19 | - type: markdown 20 | attributes: 21 | value: | 22 | Love Fuse.js? Please consider supporting: 23 | 👉 https://github.com/sponsors/krisk 24 | 👉 https://www.patreon.com/krisk 25 | 👉 https://www.paypal.com/paypalme2/kirorisk 26 | -------------------------------------------------------------------------------- /.github/workflows/nodejs.yml: -------------------------------------------------------------------------------- 1 | # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions 3 | 4 | name: Node.js CI 5 | 6 | on: 7 | push: 8 | branches: 9 | - master 10 | pull_request: 11 | branches: 12 | - master 13 | 14 | concurrency: 15 | group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} 16 | cancel-in-progress: true 17 | 18 | jobs: 19 | build: 20 | runs-on: ubuntu-latest 21 | 22 | strategy: 23 | matrix: 24 | node: [14, 15, 16, 17, 18, 19] 25 | 26 | steps: 27 | - name: Checkout Project 28 | uses: actions/checkout@v3 29 | 30 | - name: Use Node.js v${{ matrix.node }} 31 | uses: actions/setup-node@v3 32 | with: 33 | node-version: ${{ matrix.node }} 34 | 35 | - name: Install Dependencies 36 | run: npm ci 37 | 38 | - name: Build Code 39 | run: npm run build 40 | 41 | - name: Test Code 42 | run: npm run test 43 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | name: Mark stale issues 2 | 3 | on: 4 | schedule: 5 | - cron: '0 0 * * *' 6 | 7 | jobs: 8 | stale: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/stale@v7 12 | with: 13 | stale-issue-message: 'This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 30 days' 14 | days-before-stale: 120 15 | days-before-close: 30 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | *.log 3 | 4 | .DS_Store 5 | .idea/ 6 | 7 | .vs/ 8 | .vscode/ 9 | 10 | # Ignore yarn lock files 11 | yarn.lock 12 | 13 | dist/*.d.ts 14 | dist/*.js 15 | dist/*.map 16 | docs/.vuepress/dist 17 | RELEASE_NOTE*.md 18 | 19 | playground/ 20 | Makefile 21 | 22 | # Vuepress files 23 | .temp 24 | .cache 25 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | npx --no -- commitlint --edit "$1" 5 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npm test 5 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | legacy-peer-deps=true 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | CHANGELOG.md 3 | docs/.vuepress/.temp/ 4 | docs/.vuepress/.cache/ 5 | -------------------------------------------------------------------------------- /.prettierrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | trailingComma: 'none', 3 | tabWidth: 2, 4 | semi: false, 5 | singleQuote: true, 6 | overrides: [ 7 | { 8 | files: '*.svg', 9 | options: { 10 | parser: 'html' 11 | } 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Fuse.js 2 | 3 | We'd love for you to contribute to our source code and to make Fuse.js better! Here are the guidelines we'd like you to follow: 4 | 5 | - [Questions and Problems](#question) 6 | - [Issues and Bugs](#issue) 7 | - [Pull Request Submission Guidelines](#submit-pr) 8 | 9 | ## Questions, Bugs, Features 10 | 11 | ### Got a Question or Problem? 12 | 13 | Do not open issues for general support questions as we want to keep GitHub issues for bug reports and feature requests. You've got much better chances of getting your question answered on dedicated support platforms, the best being [Stack Overflow][stackoverflow]. 14 | 15 | ### Found an Issue or Bug? 16 | 17 | If you find a bug in the source code, you can help us by submitting an issue to our 18 | [GitHub Repository][github]. Even better, you can submit a Pull Request with a fix. 19 | 20 | When creating issues, it's important to follow common guidelines to make them extra clear. Here is a few links to help you achieve that: 21 | 22 | - [GitHub Guides: Mastering Issues](https://guides.github.com/features/issues/) 23 | - [Wiredcraft: How We Write Github Issues](https://wiredcraft.com/blog/how-we-write-our-github-issues/) 24 | - [NYC Planning Digital: Writing a proper GitHub issue](https://medium.com/nyc-planning-digital/writing-a-proper-github-issue-97427d62a20f) 25 | 26 | ## Pull Request Submission Guidelines 27 | 28 | Before you submit your pull request consider the following guidelines: 29 | 30 | - Search [GitHub](https://github.com/krisk/Fuse/pulls) for an open or closed Pull Request that relates to your submission. You don't want to duplicate effort. 31 | - Make your changes in a new git branch: 32 | 33 | ```shell 34 | git checkout -b my-fix-branch main 35 | ``` 36 | 37 | - Create your patch commit, **including appropriate test cases**. 38 | - Run `npm run lint` to check that you have followed the automatically enforced coding rules 39 | - Commit your changes using a descriptive commit message that follows our 40 | [commit message conventions][developers.commits]. Adherence to the 41 | [commit message conventions][developers.commits] is required, because release notes are 42 | automatically generated from these messages. 43 | 44 | ```shell 45 | git commit -a 46 | ``` 47 | 48 | - Before creating the Pull Request, package and run all tests a last time: 49 | 50 | ```shell 51 | npm run test 52 | ``` 53 | 54 | - Push your branch to GitHub: 55 | 56 | ```shell 57 | git push origin my-fix-branch 58 | ``` 59 | 60 | - If we suggest changes, then: 61 | 62 | - Make the required updates. 63 | - Re-run the test suite to ensure tests are still passing. 64 | - Commit your changes to your branch (e.g. `my-fix-branch`). 65 | - Push the changes to your GitHub repository (this will update your Pull Request). 66 | 67 | You can also amend the initial commits and force push them to the branch. 68 | 69 | ```shell 70 | git rebase main -i 71 | git push origin my-fix-branch -f 72 | ``` 73 | 74 | This is generally easier to follow, but separate commits are useful if the Pull Request contains 75 | iterations that might be interesting to see side-by-side. 76 | 77 | That's it! Thank you for your contribution! 78 | 79 | ### After your pull request is merged 80 | 81 | After your pull request is merged, you can safely delete your branch and pull the changes 82 | from the main (upstream) repository: 83 | 84 | - Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows: 85 | 86 | ```shell 87 | git push origin --delete my-fix-branch 88 | ``` 89 | 90 | - Check out the main branch: 91 | 92 | ```shell 93 | git checkout main -f 94 | ``` 95 | 96 | - Delete the local branch: 97 | 98 | ```shell 99 | git branch -D my-fix-branch 100 | ``` 101 | 102 | - Update your main with the latest upstream version: 103 | 104 | ```shell 105 | git pull --ff upstream main 106 | ``` 107 | 108 | [stackoverflow]: http://stackoverflow.com/questions/tagged/fuse.js 109 | [github]: https://github.com/krisk/Fuse/issues 110 | [developers.commits]: DEVELOPERS.md#commits 111 | -------------------------------------------------------------------------------- /DEVELOPERS.md: -------------------------------------------------------------------------------- 1 | # Developing Fuse.js 2 | 3 | - [Running Tests](#tests) 4 | - [Commit Message Guidelines](#commits) 5 | 6 | ## Running Tests 7 | 8 | ```shell 9 | npm run test 10 | ``` 11 | 12 | ## Git Commit Guidelines 13 | 14 | Fuse.js follows [conventional commits](conventional-commits). This leads to **more readable messages** that are easy to follow when looking through the **project history**. Also, these git commit messages are used to **generate the [changelog](changelog)**. 15 | 16 | ### Commit Message Format 17 | 18 | Each commit message consists of a **header**, a **body** and a **footer**. The header has a special format that includes a **type**, a **scope** and a **subject**: 19 | 20 | ``` 21 | (): 22 | 23 | 24 | 25 |