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

name-match

v1.0.4

Published

A robust name matching library combining multiple algorithms for optimal performance

Downloads

9,145

Readme

Enhanced Name Matcher

A robust name matching library for Node.js that combines multiple string similarity algorithms for optimal name matching performance.

npm version License: MIT

Features

  • Combined Algorithms: Uses both Natural.js and a custom enhanced matcher for superior matching results
  • Name-Specific Optimizations: Handles common name matching challenges like nicknames, middle names, and reversed order
  • Comprehensive Approach: Considers multiple strategies and selects the best match
  • Flexible Threshold: Configurable similarity threshold for matches
  • Utility Functions: Includes name normalization, parsing, and standardization

Installation

npm install name-match

Quick Start

const { match, isMatch } = require('name-match');

// Get similarity score (0-1)
const score = match('John Smith', 'Smith, John');
console.log(score); // 0.87

// Check if names match (using default threshold of 0.75)
const matched = isMatch('Robert Johnson', 'Bob Johnson');
console.log(matched); // true

Detailed Usage

Creating a Matcher Instance

const { EnhancedNaturalMatcher } = require('name-match');

// Create matcher with custom threshold
const matcher = new EnhancedNaturalMatcher({ threshold: 0.75 });

// Calculate similarity score
const score = matcher.getSimilarity('William Jones', 'Bill Jones');
console.log(score); // 0.78

// Check if names match using custom threshold
const matched = matcher.isMatch('Michael Smith', 'Mike Smith');
console.log(matched); // true

Matching Groups of Names

const { matchGroup } = require('name-match');

// Check if all names in a group refer to the same person
const nameGroup = [
  'Aaron Charles Donovan',
  'Aaron Donovan',
  'Donovan Aaron C'
];

const result = matchGroup(nameGroup);
console.log(result.score); // 0.76
console.log(result.isMatch); // true
console.log(result.matches); // Detailed match information for each pair

Name Normalization

const { NameNormalizer } = require('name-match');

// Parse a name into components
const parsed = NameNormalizer.parseName('Dr. John William Smith Jr.');
console.log(parsed);
/*
{
  original: 'Dr. John William Smith Jr.',
  cleaned: 'dr john william smith jr',
  normalized: 'dr john william smith jr',
  prefixes: [ 'dr' ],
  firstName: 'john',
  middleNames: [ 'william' ],
  lastName: 'smith',
  suffixes: [ 'jr' ],
  initials: { first: 'j', middle: 'w', last: 's' }
}
*/

// Get name variations
const variations = NameNormalizer.getNameVariations('William Smith');
console.log(variations);
// [ 'william smith', 'will smith', 'bill smith', 'billy smith', 'willy smith' ]

Challenges Handled

The library is specifically designed to handle these common name matching challenges:

  • Different name formats (first last vs. last, first)
  • Middle names and initials
  • Nicknames and formal names
  • Suffixes (Jr, Sr, III)
  • Titles and prefixes (Mr, Dr, etc.)
  • Compound last names
  • Hyphenated names
  • Different character casing
  • Special characters
  • Spacing variations

How It Works

This library combines two powerful approaches:

  1. Natural.js: Uses industry-standard string similarity algorithms (Jaro-Winkler, Dice, Levenshtein)
  2. Enhanced Matcher: Uses name-specific strategies like token matching, initials comparison, and nickname handling

The final score is an average of these two approaches, providing more robust and accurate results than either method alone.

License

MIT