fastest-levenshtein

The fastest JavaScript/TypeScript implementation of Levenshtein edit distance

Library
npm
v1.0.16
771stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
37/100Needs Attention
Development Activity0
Maintenance20
Community40
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
79/100Good
Architecture70
Code Quality78
Innovation72
Learning Curve95

fastest-levenshtein is a zero-dependency JavaScript/TypeScript library that computes the Levenshtein edit distance between two strings faster than any other published JS implementation, according to its own benchmark suite against js-levenshtein, leven, fast-levenshtein, and others. It exposes two functions: distance() for the raw edit-distance number, and closest() for finding the string in an array with the smallest edit distance to a target.

The entire implementation lives in a single TypeScript file (mod.ts) with no runtime dependencies, and ships prebuilt CommonJS and ESM outputs alongside .d.ts type declarations. It works identically under Node.js and Deno, making it a drop-in choice anywhere fuzzy string matching, spell-check suggestion, or typo-tolerant search needs a fast core distance metric.

What You Get

  • A distance(a, b) function returning the Levenshtein edit distance between two strings
  • A closest(target, candidates) function returning the candidate string with the smallest edit distance to the target
  • Zero runtime dependencies and a small single-file implementation, keeping install and parse cost minimal
  • Prebuilt CommonJS and ESM builds plus TypeScript type declarations out of the box
  • Published benchmarks showing consistently higher ops/sec than js-levenshtein, leven, fast-levenshtein, and levenshtein-edit-distance across string lengths from N=4 to N=1024

Common Use Cases

  • Typo-tolerant search or autocomplete: ranking candidate strings by similarity to a user’s query
  • Spell-check suggestion engines that need to find the closest dictionary word to a misspelled input
  • Fuzzy matching of user input against a fixed set of commands, tags, or identifiers
  • Deduplication or record-linkage pipelines that score near-duplicate strings by edit distance

Under The Hood

Architecture - The library is a single TypeScript source file, mod.ts (142 lines), exporting exactly two functions: distance and closest. There is no class hierarchy, no configuration object, and no plugin surface — the entire public API is these two pure functions operating on strings and arrays of strings. closest is implemented as a thin wrapper that iterates candidates and calls distance for each, tracking the minimum. Tech Stack - Written in TypeScript, compiled to both CommonJS (mod.js) and ESM (esm/mod.js) via tsc, with a separate tsconfig.esm.json for the ESM build target. It has zero runtime dependencies; devDependencies are limited to TypeScript, Jest for testing, ESLint/Prettier for linting, and several competing Levenshtein implementations (fast-levenshtein, js-levenshtein, leven, natural, talisman) pulled in purely to drive the comparative benchmark suite (bench.ts). Code Quality - Tests exist under test.ts and run via Jest with coverage reporting wired to Coveralls in CI. Given the algorithm’s narrow, well-defined scope (a single numeric function plus a thin wrapper), the surface area for bugs is small; the codebase favors dense, optimized loop logic over abstraction, which is typical and appropriate for a performance-focused micro-library. Repository activity has been low in recent years (last push 2024-03), consistent with a small utility that reached feature-complete maturity rather than one that is unmaintained by neglect. API Design - Getting started requires a single import and a single function call — distance('fast', 'faster') — with no configuration, options object, or setup step. This minimalism is the library’s main developer-experience strength: it does exactly one thing and exposes exactly the two functions needed to do it, in both Node and Deno without any adapter code.

Used by 9 apps in this directory

TypeScript
84%
Apache 2.0

Continue

Developer Tools · AI Development · AI Code Assistants

35,532

Open-source coding agent for VS Code, JetBrains, and CLI with support for 30+ LLM providers.

View details
87
Repo Health
88
Technical
65
Dependency
Built with
TypeScript84%
Updated today
TypeScript
99%
AGPL 3.0

Karakeep

Bookmarks Archiving

28,454

Self-hosted bookmark manager that captures links, notes, images, and PDFs with AI tagging, full-text search, and automatic archiving.

View details
88
Repo Health
76
Technical
67
Dependency
Built with
TypeScript99%
Updated 3 days ago
TypeScript
97%
Other

Kibana

Analytics · Monitoring

21,251

Your open source window into the Elastic Stack — query, visualize, and act on data stored in Elasticsearch with real-time dashboards, AI-assisted search, and automated alerting.

View details
98
Repo Health
87
Technical
68
Dependency
Built with
TypeScript97%
Updated today
TypeScript
98%
Other

Langfuse

AI Development · Monitoring

33,366

Open source AI engineering platform for LLM observability, prompt management, evaluation, and debugging — self-host in minutes or use Langfuse Cloud.

View details
92
Repo Health
81
Technical
66
Dependency
Built with
TypeScript98%
Updated today
TypeScript
96%
Other

Lightdash

Analytics · Data Engineering

6,056

The open-source Looker alternative that turns your dbt project's metrics and dimensions into governed, self-serve charts and dashboards — no license key required.

View details
93
Repo Health
84
Technical
66
Dependency
Built with
TypeScript96%
Updated today
TypeScript
99%
Apache 2.0

Mastra Code

AI Code Assistants

27,294

"A coding agent that never compacts" — a terminal-based AI coding agent built on the Mastra framework, with Observational Memory instead of context compaction, multi-model support, and OAuth login for Claude Max or ChatGPT Plus.

View details
88
Repo Health
73
Technical
66
Dependency
Built with
TypeScript99%
Updated today
TypeScript
92%
Other

n8n

Automation · No Code Platforms

201,152

Code when you need it, UI when you don't — the workflow automation platform built for technical teams who refuse to choose.

View details
95
Repo Health
87
Technical
66
Dependency
Built with
TypeScript92%
Updated today
TypeScript
97%
MIT

Promptfoo

AI Development

24,362

An open-source CLI and library for evaluating and red-teaming LLM applications — replace trial-and-error prompt engineering with systematic evals, vulnerability scanning, and CI/CD integration.

View details
90
Repo Health
73
Technical
68
Dependency
Built with
TypeScript97%
Updated yesterday
TypeScript
87%
MIT

RelayPlane

AI Agents

198

An npm-native, drop-in LLM proxy for Node.js — swap in as your OpenAI/Anthropic base URL to get per-request cost tracking, task-aware routing, budget enforcement, and anomaly detection running locally, for free.

View details
63
Repo Health
68
Technical
75
Dependency
Built with
TypeScript87%
JavaScript10%
Updated 2 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search