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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@bybrave/string-similarity2

v5.0.1

Published

Maintained string-similarity fork: zero dependencies, ESM + CommonJS, built-in TypeScript types, findBestMatch keySelector for object arrays. Drop-in for string-similarity.

Downloads

319

Readme

@bybrave/string-similarity2

Maintained fork of string-similarity — finds the degree of similarity between two strings, based on the Sørensen–Dice coefficient.

The original is deprecated by its author. This fork keeps the exact same ratings, and adds zero dependencies, dual ESM + CommonJS, built-in TypeScript types, and a keySelector for matching against object arrays.

Install

npm install @bybrave/string-similarity2

Usage

import { compareTwoStrings, findBestMatch } from '@bybrave/string-similarity2';

compareTwoStrings('healed', 'sealed'); // 0.8

findBestMatch('healed', ['edward', 'sealed', 'theatre']);
// {
//   ratings: [ { target: 'edward', rating: 0.2 }, { target: 'sealed', rating: 0.8 }, ... ],
//   bestMatch: { target: 'sealed', rating: 0.8 },
//   bestMatchIndex: 1
// }

CommonJS works too — require returns the same { compareTwoStrings, findBestMatch } object as the original:

const stringSimilarity = require('@bybrave/string-similarity2');
stringSimilarity.compareTwoStrings('france', 'france'); // 1

Matching object arrays (#125)

Pass a third keySelector argument to rate against a property while keeping the original objects in ratings[].target:

const users = [
  { id: 1, name: 'edward' },
  { id: 2, name: 'sealed' },
];
const { bestMatch } = findBestMatch('healed', users, (u) => u.name);
bestMatch.target; // { id: 2, name: 'sealed' }

What's changed vs [email protected]

| Issue | Change | |---|---| | #128, #20 | Ships as native ESM with a CommonJS build via the exports map — no CJS optimization bailouts, bundler-friendly. | | #125 | findBestMatch accepts an optional keySelector to match against an array of objects. | | #127 | License is consistently MIT (the original's package.json said ISC while its LICENSE said MIT). | | — | Built-in TypeScript types (no separate @types/string-similarity needed). | | — | Zero dependencies; maintained (the original is deprecated). |

Migration from string-similarity

Drop-in — replace the import:

- const stringSimilarity = require('string-similarity');
+ const stringSimilarity = require('@bybrave/string-similarity2');

Ratings are identical to [email protected] (the Dice-coefficient formula is unchanged, including its whitespace stripping and the length < 2 → 0 behaviour).

Support

If this package saves you time, you can support maintenance:

Ko-fi Bitcoin

Bitcoin (BTC): bc1q37557q5jpeaxqydzwvf3jgj7zhnfpn2td3q40q

License

MIT. Copyright © Akash Kurdekar; fork © bybrave.