npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

cmpstr

v3.0.4

Published

CmpStr is a lightweight, fast and well performing package for calculating string similarity

Downloads

4,232

Readme

CmpStr - Modern String Similarity Package

GitHub License Static Badge Static Badge GitHub package.json version npm bundle size NPM Downloads GitHub Actions Workflow Status Static Badge Static Badge

CmpStr is a TypeScript library for advanced string comparison, similarity measurement, phonetic indexing, and text analysis. It includes implementations of several established algorithms such as Levenshtein, Dice–Sørensen, Damerau–Levenshtein and Soundex. The library has no external dependencies and allows for the integration of custom metrics, phonetic mappings, and normalization filters.

CmpStr provides a unified API for single, batch and pairwise operations. It is suitable for a range of use cases in application development and research. The package includes support for both ESM and CommonJS environments, TypeScript type declarations and a browser-compatible JavaScript bundle.

Originally launched in 2023 with a minimal feature set, the library was redesigned in 2025 to support a broader set of algorithms and processing features. The current version offers asynchronous operation, configurable normalization and filtering pipelines, phonetic search functionality, and basic tools for string differencing.

Key Features

  • Unified API for string similarity, distance measurement and matching
  • Modular metric system with support for algorithms such as Levenshtein, Jaro-Winkler, Cosine etc.
  • Integrated phonetic algorithms (e.g., Soundex, Metaphone) with configurable registry
  • Normalization and filtering pipeline for consistent input processing
  • Single, batch and pairwise comparisons with structured, type-safe results
  • Phonetic-aware search and comparison
  • Utilities for text structure and readability analysis (e.g., syllables, word statistics)
  • Diffing tools with CLI-friendly formatting
  • TypeScript-native with full type declarations and extensibility
  • Supports asynchronous workflows for scalable, non-blocking processing
  • Extensible architecture for integrating custom algorithms and filters

Getting Started

Working with CmpStr is simple and straightforward. The package is installed just like any other using the following command:

npm install cmpstr

Minimal usage example:

import { CmpStr } from 'cmpstr';

const cmp = CmpStr.create().setMetric( 'levenshtein' ).setFlags( 'i' );

const result = cmp.test( [ 'hello', 'hola' ], 'Hallo' );

console.log( result );
// { source: 'hello', target: 'Hallo', match: 0.8 }

For asynchronous workloads:

import { CmpStrAsync } from 'cmpstr';

const cmp = CmpStrAsync.create().setProcessors( {
  phonetic: { algo: 'soundex' }
} );

const result = await cmp.searchAsync( 'Maier', [
  'Meyer', 'Müller', 'Miller', 'Meyers', 'Meier'
] );

console.log( result );
// [ 'Meyer', 'Meier' ]

Try with OneCompiler.

CLI Tool

Try out or use CmpStr on the terminal. Install the cmpstr-cli package and use many features of CmpStr directly on the console via the cmpstr command. Many options and parameters also make the command suitable for scripts and automatic processing.

Documentation

The full documentation, API reference and advanced usage examples are available in the GitHub Wiki.

LICENSE MIT © 2023-2025 PAUL KÖHLER (KOMED3)