JavaScript ISC

fuzzy-search

Simple fuzzy search

W

wouterrutgers

Dernière activité 19 sept. 2026
wouterrutgers/fuzzy-search

227

étoiles

28

forks

0

issues ouvertes

Ce README est souvent en anglais.

Fuzzy search

Simple lightweight fuzzy search library written in JavaScript, with zero runtime dependencies!

Checks npm npm Donate

Installation

Using npm

npm install fuzzy-search

Using pnpm

pnpm add fuzzy-search

Using <script>

<script src="https://raw.githubusercontent.com/wouterrutgers/fuzzy-search/HEAD/FuzzySearch.js"></script>

The browser bundle is available at dist/FuzzySearch.js in the published package and exposes FuzzySearch globally.

Quick start guide

// This can be excluded when loaded via <script>
import FuzzySearch from 'fuzzy-search'; // Or: var FuzzySearch = require('fuzzy-search');

const people = [{
  name: {
    firstName: 'Jesse',
    lastName: 'Bowen',
  },
  state: 'Seattle',
}];

const searcher = new FuzzySearch(people, ['name.firstName', 'state'], {
  caseSensitive: true,
});
const result = searcher.search('ess');

Development

Use Node.js 24 and pnpm. Run pnpm install, pnpm test, pnpm lint, pnpm build, and pnpm test:package.

Documentation

const searcher = new FuzzySearch(<haystack>, [keys], [options]);
const result = searcher.search(<needle>);

haystack (type: Array)

Array of objects containing the search list.


[keys] (type: Array, default: [])

List of properties that will be searched. This also supports nested properties.


[options] (type: Object)

Object with options that will configure the search. Scroll/Swipe down to see more information on what options are available.


<needle> (type: String, default: '')

The string to Fuzzy Search on.

Options

caseSensitive (type: Boolean, default: false)

Indicates whether comparisons should be case sensitive.

sort (type: Boolean, default: false)

When true it will sort the results by best match (when searching for abc in the search set ['a__b__c', 'abc'] it would return abc as the first result).

When false it will return the results in the original order.

Projets similaires

Lightweight fuzzy-search, in JavaScript

JavaScriptbitapjavascriptlightweight-fuzzy-search
Kkrisk
20,5 k étoiles818

Fast SublimeText-like fuzzy search for JavaScript.

JavaScriptfilterfuzzyjavascript
Ffarzher
4,4 k étoiles160

A tiny, efficient fuzzy search that doesn't suck

JavaScriptautocompletefilter-listfuzzy-matching
Lleeoniya
3 k étoiles58