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

contactfilter

v1.0.0

Published

Filters post content to disallow contact information like phone numbers, emails, and disallowed domains.

Readme

contactfilter

Filters post content to disallow contact information like phone numbers, emails, and disallowed domains.

Features

  • Disallows Contact Information: Prevents the posting of phone numbers and email addresses.
  • Domain Whitelisting: Allows links only to specified domains and their subdomains.
  • Configurable: Supports custom disallowed keywords, allowed domains, and regex patterns for phone and email detection.
  • Social Handle Permitted: Social handles (e.g., @username) are not disallowed by default.

Installation

npm install contactfilter

Usage

const filterContactInfo = require('contactfilter');

// Using default configuration:
const result1 = filterContactInfo("This is a normal post.");
console.log(result1); // { allowed: true }

// Using custom configuration:
const customConfig = {
  disallowedKeywords: ["dm", "contact"], // Note: Keywords are no longer used for disallowing by default.
  allowedDomains: ["example.com", "mycompany.org"],
  phoneRegex: /.../, // your custom regex
  emailRegex: /.../, // your custom regex
};
const result2 = filterContactInfo("DM me at [email protected]", customConfig);
console.log(result2); // { allowed: false, reason: "Posting contact information is not allowed." }

// Example with a valid link to an allowed domain
const result3 = filterContactInfo("Check out https://example.com/page", customConfig);
console.log(result3); // { allowed: true }

// Example with a disallowed domain
const result4 = filterContactInfo("Check out http://www.google.com", customConfig);
console.log(result4); // { allowed: false, reason: "Posting contact information is not allowed." }

// Example with a social handle (allowed by default)
const result5 = filterContactInfo("You can follow me on social media, I'm @myuser");
console.log(result5); // { allowed: true }

API

filterContactInfo(postContent, options)

Filters post content to disallow contact information.

Parameters:

  • postContent (string): The content to filter.
  • options (object, optional): Optional configuration for filtering.
    • disallowedKeywords (string[]): An array of keywords to disallow. (Note: This is currently not used in the default filtering logic as per user instructions).
    • allowedDomains (string[]): An array of domains that are allowed in links.
    • phoneRegex (RegExp): A regex for detecting phone numbers.
    • emailRegex (RegExp): A regex for detecting email addresses.
    • socialRegex (RegExp): A regex for detecting social handles. (Note: This is currently not used for disallowing).

Returns:

  • {allowed: boolean, reason?: string}: An object indicating if the content is allowed and a reason if not.

License

MIT