Skip to content

rapid-fuzzy

Fuzzy search and string similarity for JavaScript, powered by Rust. Native in Node.js, WebAssembly everywhere else, with one API.
import { FuzzyIndex, searchObjects, levenshtein } from 'rapid-fuzzy';
const users = [
{ name: 'John Smith', city: 'Tokyo' },
{ name: 'Jane Doe', city: 'Osaka' },
];
const index = new FuzzyIndex(['TypeScript', 'JavaScript', 'Python', 'Rust']);
index.search('typscript'); // → [{ item: 'TypeScript', score: 0.86, index: 0, … }]
searchObjects('john tokyo', users, { keys: ['name', 'city'], matchMode: 'crossKey' });
levenshtein('kitten', 'sitting'); // → 3

Fast on large lists

A persistent FuzzyIndex answers a query over 10,000 items in about 0.2 ms: 180x faster than fuse.js and 1.6x faster than fuzzysort in our benchmarks. Large searches use every CPU core in Node.js.

Runs everywhere

A native addon for Node.js on macOS, Linux and Windows, and a WebAssembly build for browsers, Deno, Bun and Cloudflare Workers. Bundlers pick the right one on their own.

Search that feels like fzf

The matcher from the Helix editor, with smart case, diacritic folding, ^prefix, suffix$, 'exact and !exclude terms in any order, match positions for highlighting, and opt-in typo tolerance.

Objects with weighted keys

Search records across nested keys with weights, and choose how key scores combine and whether terms may match different keys.

String similarity built in

Levenshtein, Damerau-Levenshtein, Jaro-Winkler, Sørensen-Dice, Hamming, Indel and RapidFuzz-style token ratios, with batch and typed-array variants.

Strictly typed

Complete TypeScript declarations, with key paths checked against your item type and separate declarations for the browser build.