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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@himorishige/noren-plugin-jp

v0.6.4

Published

Japan-specific PII detection plugin for Noren (phone numbers, postal codes, MyNumber)

Readme

@himorishige/noren-plugin-jp

npm version

Japanese PII detection plugin for Noren

Specialized detectors and maskers for Japanese Personally Identifiable Information (PII) including phone numbers, postal codes, and My Number (マイナンバー).

✨ Features

📞 Phone Numbers

  • Mobile: 090, 080, 070, 060 prefixes
  • Landline: Area codes with proper validation
  • International: +81 format support
  • Context-aware: Uses hints like "電話", "TEL"

📮 Postal Codes

  • Standard format: 123-4567
  • Numeric format: 1234567
  • Context detection: "〒", "住所" hints
  • Smart masking: 〒123-4567〒•••-••••
  • ⚡ v0.6.0: Improved phone number conflict resolution

🆔 My Number (マイナンバー)

  • 12-digit validation: Proper checksum verification
  • Context required: Only detects with "マイナンバー", "個人番号" hints
  • High security: [REDACTED:MYNUMBER] output

🚀 Installation

npm install @himorishige/noren-plugin-jp @himorishige/noren-core

Basic Usage

import { Registry, redactText } from '@himorishige/noren-core';
import * as jpPlugin from '@himorishige/noren-plugin-jp';

// Initialize the Registry
const registry = new Registry({
  defaultAction: 'mask',
  enableConfidenceScoring: true, // v0.4.0: Improved accuracy
  environment: 'production',
  // Set relevant keywords as hints to improve detection accuracy
  contextHints: ['電話', '住所', '〒', 'マイナンバー'],
});

// Register the detectors and maskers from the Japan plugin
registry.use(jpPlugin.detectors, jpPlugin.maskers);

const inputText = 'My phone number is 090-1234-5678, and my address is 〒150-0001.';

// Execute the redaction process
const redactedText = await redactText(registry, inputText);

console.log(redactedText);
// Output: My phone number is •••-••••-••••, and my address is 〒•••-••••.

Detected Types

| PII Type | Description | Masking Example (mask) | v0.5.0 | | :------------- | :------------------- | :----------------------- | :------ | | phone_jp | Japanese phone number| •••-••••-•••• | ✓ Renamed | | postal_jp | Japanese postal code | 〒•••-•••• | ✓ Renamed | | mynumber_jp | My Number | [REDACTED:MYNUMBER] | ✓ Renamed |

Full-Width Character Support

This plugin works seamlessly with full-width (zenkaku) characters through Noren's built-in Unicode NFKC normalization:

// Both half-width and full-width characters are detected equally
const halfWidth = '電話: 090-1234-5678'
const fullWidth = '電話: 090-1234-5678'

// Both produce identical masking results
const result1 = await redactText(registry, halfWidth)  // → 電話: •••-••••-••••
const result2 = await redactText(registry, fullWidth)  // → 電話: •••-••••-••••

🆕 What's New in v0.6.0

⚡ Enhanced Postal Code Detection

  • Phone Number Conflict Resolution: Postal codes are no longer misdetected when they match phone number patterns
  • Improved Accuracy: TEL: 03-1234-5678 is correctly identified as a phone number, not a postal code
  • Lightweight Implementation: Simplified algorithm for better performance while maintaining accuracy

🔧 Technical Improvements

  • Removed heavy address dictionary dependencies
  • Streamlined detection logic focusing on core functionality
  • Maintained Noren's "Edge-native, Lightweight" design principles

📊 Performance Characteristics

  • Fast Processing: Optimized for edge environments
  • Low Memory Usage: Minimal memory footprint
  • Stream-First: Designed for efficient streaming operations

Examples of Improved Detection

// v0.6.0 correctly distinguishes between phone and postal codes
const testCases = [
  'TEL: 03-1234-5678',           // → Detected as phone_jp
  '〒100-0001 東京都千代田区',     // → Detected as postal_jp (high confidence)
  '住所: 123-4567',              // → Detected as postal_jp (medium confidence)
  'Phone: 090-1111-2222',        // → Detected as phone_jp
]