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

@bagdock/pii-patterns

v0.1.1

Published

PII regex patterns and scrubbing utilities for Bagdock

Readme

  ----++                                ----++                    ---+++     
  ---+++                                ---++                     ---++      
 ----+---     -----     ---------  --------++ ------     -----   ----++----- 
 ---------+ --------++----------++--------+++--------+ --------++---++---++++
 ---+++---++ ++++---++---+++---++---+++---++---+++---++---++---++------++++  
----++ ---++--------++---++----++---+++---++---++ ---+---++     -------++    
----+----+---+++---++---++----++---++----++---++---+++--++ --------+---++   
---------++--------+++--------+++--------++ -------+++ -------++---++----++  
 +++++++++   +++++++++- +++---++   ++++++++    ++++++    ++++++  ++++  ++++  
                     --------+++                                             
                       +++++++                                               

@bagdock/pii-patterns

PII regex patterns and scrubbing utilities for the Bagdock platform — 15-pattern defense-in-depth redaction for personally identifiable information.

npm version License: MIT

Install

npm install @bagdock/pii-patterns
yarn add @bagdock/pii-patterns
pnpm add @bagdock/pii-patterns
bun add @bagdock/pii-patterns

Usage

import { scrubPii, scrubPiiDeep, scrubMessagesForModel } from '@bagdock/pii-patterns'

// Scrub a single string
scrubPii('Email me at [email protected]')
// → 'Email me at [EMAIL_REDACTED]'

// Recursively scrub nested objects
scrubPiiDeep({ email: '[email protected]', count: 42 })
// → { email: '[EMAIL_REDACTED]', count: 42 }

// Scrub user messages before sending to an AI model
const messages = [
  { role: 'system', content: 'You are helpful.' },
  { role: 'user', content: 'My SSN is 123-45-6789' },
]
scrubMessagesForModel(messages)
// → [{ role: 'system', content: 'You are helpful.' },
//    { role: 'user', content: 'My SSN is [SSN_REDACTED]' }]

API

scrubPii(text: string): string

Applies all 15 PII patterns in order and returns the redacted string.

scrubPiiDeep(value: unknown): unknown

Recursively walks objects and arrays, scrubbing any string values. Non-string primitives pass through unchanged.

scrubMessagesForModel<T>(messages: T[]): T[]

Scrubs PII from user role messages before AI inference. Assistant and system messages pass through unchanged. Returns a shallow copy — originals are not mutated.

Patterns

15 PII types are detected and redacted:

| Pattern | Token | Coverage | |---------|-------|----------| | Email address | [EMAIL_REDACTED] | Global | | Social Security Number | [SSN_REDACTED] | US | | National Insurance Number | [NINO_REDACTED] | UK | | IBAN | [IBAN_REDACTED] | EU/UK | | NHS Number | [NHS_REDACTED] | UK | | PPS Number | [PPSN_REDACTED] | Ireland | | Driving Licence | [LICENCE_REDACTED] | UK (DVLA format) | | Sort Code + Account | [BANKACCT_REDACTED] | UK | | VAT Number | [VAT_REDACTED] | EU | | Credit/Debit Card | [CARD_REDACTED] | Global | | Phone Number | [PHONE_REDACTED] | Global | | Date of Birth | [DOB_REDACTED] | Global | | Postcode | [POSTCODE_REDACTED] | UK | | ZIP Code | [ZIP_REDACTED] | US | | Passport/ID Number | [ID_REDACTED] | Global |

Defense-in-depth

This package provides client-side PII scrubbing as a defense-in-depth layer. It is not a substitute for server-side controls. The Bagdock platform applies authoritative PII scrubbing on the server edge before any AI model receives input.

License

MIT — see LICENSE.