# string-typo-match

> Match typing errors against candidate strings with weighted omissions, swaps, and explainable ambiguity

Latest version **1.1.0** (published 2026-09-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install string-typo-match
pnpm add string-typo-match
yarn add string-typo-match
bun add string-typo-match
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2026-09-06 |
| First published | 2026-09-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=18.20.8 |
| Dependencies | 0 |
| Unpacked size | 33.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 214 |
| Author | Roy Revelt |
| Maintainers | royston |
| Keywords | ambiguity, fuzzy, match, omission, string, typo |

## Links

- npm: https://www.npmjs.com/package/string-typo-match
- Repository: https://github.com/codsen/codsen
- Homepage: https://codsen.com/os/string-typo-match
- Issues: https://github.com/codsen/codsen/issues
- npm.io page: https://npm.io/package/string-typo-match

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 1.1.0 (latest) — 2026-09-06
- 0.0.1 — 2026-09-05

## README

<h1 align="center">string-typo-match</h1>

<p align="center">Match typing errors against candidate strings with weighted omissions, swaps, and explainable ambiguity</p>

<p align="center">
  <a href="https://codsen.com/os/string-typo-match" rel="nofollow noreferrer noopener">
    <img src="https://img.shields.io/badge/-codsen-blue?style=flat-square" alt="page on codsen.com">
  </a>
  <a href="https://www.npmjs.com/package/string-typo-match" rel="nofollow noreferrer noopener">
    <img src="https://img.shields.io/badge/-npm-blue?style=flat-square" alt="page on npm">
  </a>
  <a href="https://github.com/codsen/codsen/tree/main/packages/string-typo-match" rel="nofollow noreferrer noopener">
    <img src="https://img.shields.io/badge/-github-blue?style=flat-square" alt="page on github">
  </a>
  <a href="https://npmcharts.com/compare/string-typo-match?interval=30" rel="nofollow noreferrer noopener" target="_blank">
    <img src="https://img.shields.io/npm/dm/string-typo-match.svg?style=flat-square" alt="Downloads per month">
  </a>
  <a href="https://codsen.com/os/string-typo-match/changelog" rel="nofollow noreferrer noopener">
    <img src="https://img.shields.io/badge/changelog-here-brightgreen?style=flat-square" alt="changelog">
  </a>
  <img src="https://img.shields.io/badge/licence-MIT-brightgreen.svg?style=flat-square" alt="MIT Licence">
</p>

**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](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).

```bash
npm i string-typo-match
```

## Quick Take

```js
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](https://codsen.com/os/string-typo-match/) for a full description of the API. For **Changelog**, see [raw md on GitHub](https://github.com/codsen/codsen/blob/main/packages/string-typo-match/CHANGELOG.md) or [the website](https://codsen.com/os/string-typo-match/changelog).

## Contributing

To report bugs or request features or assistance, [raise an issue](https://github.com/codsen/codsen/issues/new/choose) on GitHub.

## Licence

MIT License

Copyright © 2010-2026 Roy Revelt and other contributors

<p align="center"><img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center"></p>

---
_Source: https://npm.io/package/string-typo-match · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
