string-typo-match
v1.1.0
Published
Match typing errors against candidate strings with weighted omissions, swaps, and explainable ambiguity
Maintainers
Readme
No dependencies whatsoever. This package declares no dependencies or devDependencies.
Features
A leven alternative for matching human typing errors against your own dictionary, with optional keyboard awareness and explained suggestions.
- Treat a missing chunk as one typo, with limits on how much can disappear.
- Recognise missed keys, extra characters, repeats, substitutions, and adjacent swaps.
- Enable QWERTY weighting or supply your own keyboard map.
- Tune error costs and allow one or two typo events.
- Keep exact matches, rank fuzzy suggestions, and flag ambiguity.
- Match Unicode code points; explain edits with original-string offsets.
- Prepare dictionaries once; track progress and completion statistics.
- Get TypeScript types, ESM, and a standalone browser script without dependencies.
Install
This package is pure ESM.
npm i string-typo-matchQuick Take
import assert from "node:assert/strict";
import { matchTypos } from "string-typo-match";
const result = matchTypos("Lenstein", ["Levenstein", "Einstein"]);
assert.equal(result.bestMatch, "Levenstein");
assert.equal(result.matches[0].operations[0].kind, "omitted-block");Documentation
Please visit codsen.com for a full description of the API. For Changelog, see raw md on GitHub or the website.
Contributing
To report bugs or request features or assistance, raise an issue on GitHub.
Licence
MIT License
Copyright © 2010-2026 Roy Revelt and other contributors
