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

@obexai/detection

v0.2.0

Published

PII detection engine — regex patterns and NER for structured and unstructured PII

Downloads

251

Readme

@obexai/detection

PII detection engine for JavaScript/TypeScript. 26 regex patterns with validators, configurable sensitivity, and sub-5ms latency.

Install

npm install @obexai/detection

Quick Start

import { PiiDetector } from "@obexai/detection";

const detector = new PiiDetector({ sensitivity: "medium" });
const result = detector.scan("Contact [email protected] or call 020 7946 0958");

console.log(result.entities);
// [{ type: "email", value: "[email protected]", confidence: 0.95, ... },
//  { type: "phone", value: "020 7946 0958", confidence: 0.8, ... }]

console.log(result.redacted);
// "Contact [EMAIL_1] or call [PHONE_1]"

console.log(result.score);     // 0.67 (risk score 0-1)
console.log(result.latencyMs); // ~2ms

What It Detects

26 patterns across 7 categories:

| Category | Entity Types | Count | Validators | |----------|-------------|-------|------------| | Contact | Email, phone (UK, US, international) | 4 | — | | Financial | Credit card, debit card, IBAN, sort code | 4 | Luhn checksum (cards), date rejection (sort code) | | UK Government | National Insurance, NHS number, UTR, passport | 4 | NHS modulus 11 | | Network | IPv4, IPv6 | 2 | Excludes localhost/broadcast | | Location | UK postcode | 1 | — | | Temporal | Date of birth (DD/MM/YYYY, ISO, US format) | 3 | — | | Secrets | AWS keys, generic API keys, Bearer tokens, JWT, Slack/GitHub/Stripe tokens | 8 | — |

Configuration

const detector = new PiiDetector({
  sensitivity: "high",          // "low" | "medium" | "high"
  entities: ["email", "phone"], // only detect these types
  exclude: ["uk_postcode"],     // skip these types
});

Sensitivity levels

| Level | Confidence threshold | Behaviour | |-------|---------------------|-----------| | low | 0.8 | Only high-confidence matches (fewer false positives) | | medium | 0.5 | Balanced (default) | | high | 0.3 | Aggressive — catches more, including low-confidence patterns like passport numbers |

Custom Patterns

import { registerPatterns } from "@obexai/detection";

registerPatterns([{
  type: "email",
  regex: /my-custom-pattern/g,
  confidence: 0.9,
  validate: (match) => match.length > 5, // optional validator
}]);

API

PiiDetector

const detector = new PiiDetector(config?: DetectorConfig);
const result = detector.scan(text: string): DetectionResult;

DetectionResult

{
  entities: PiiEntity[];  // all detected PII
  redacted: string;       // input with PII replaced by [TYPE_N] tokens
  score: number;          // overall risk score 0-1
  latencyMs: number;      // scan duration in ms
}

PiiEntity

{
  type: string;           // e.g. "email", "credit_card"
  value: string;          // the matched text
  start: number;          // start index in original string
  end: number;            // end index in original string
  confidence: number;     // 0-1
  source: "regex" | "ner";
}

License

MIT