{"id":41724,"library":"piiranha","title":"Piiranha","description":"Piiranha v3.5.8 is a TypeScript library for removing personally identifiable information (PII) from text. It provides both synchronous and asynchronous APIs, built-in regex patterns for common PII types (names, emails, phone numbers, credit card numbers, IP addresses, SSNs, etc.), and supports custom redaction rules and replacement values. It is a maintained fork of solvvy/redact-pii, compiles to ES2016, and is tested on Node.js 18.x and 20.x. Key differentiators: dual sync/async API, customizable replacements, and extensible via custom regex or functions.","status":"active","version":"3.5.8","language":"javascript","source_language":"en","source_url":"https://github.com/NointidWorks/piiranha","tags":["javascript","typescript"],"install":[{"cmd":"npm install piiranha","lang":"bash","label":"npm"},{"cmd":"yarn add piiranha","lang":"bash","label":"yarn"},{"cmd":"pnpm add piiranha","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Correct ESM import for synchronous redactor.","wrong":"const SyncRedactor = require('piiranha').SyncRedactor","symbol":"SyncRedactor","correct":"import { SyncRedactor } from 'piiranha'"},{"note":"ESM import for asynchronous redactor. Also works with dynamic import.","wrong":"","symbol":"AsyncRedactor","correct":"import { AsyncRedactor } from 'piiranha'"}],"quickstart":{"code":"import { SyncRedactor } from 'piiranha';\nconst redactor = new SyncRedactor();\nconst redacted = redactor.redact('Hi David Johnson, call 555-555-5555');\nconsole.log(redacted); // Hi NAME, call PHONE_NUMBER","lang":"typescript","description":"Synchronous PII redaction: redacts names and phone numbers from a string."},"warnings":[{"fix":"Set custom replaceWith values in configuration if you need the old behavior.","message":"v3.0.0 changed the default replacement value from '***' to 'NAME', 'PHONE_NUMBER', etc.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Replace require('redact-pii') or import from 'redact-pii' with 'piiranha'.","message":"The previous package name 'redact-pii' is deprecated; use 'piiranha'.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Use await or .then() when calling redactAsync().","message":"Async redactor must be awaited or used with .then(); otherwise, it returns a Promise object, not a string.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Update configuration references from 'ssn' to 'usSocialSecurityNumber'.","message":"v2.0.0 removed the built-in 'ssn' pattern; renamed to 'usSocialSecurityNumber'.","severity":"breaking","affected_versions":">=2.0.0"}],"env_vars":null,"search_vec":"'18':66 '20':69 'address':40 'api':22,75 'asynchron':21 'built':24 'built-in':23 'card':37 'common':29 'compil':58 'credit':36 'custom':45,81 'customiz':76 'differenti':72 'dual':73 'email':33 'es2016':60 'etc':42 'extens':79 'fork':55 'function':84 'identifi':11 'inform':12 'ip':39 'javascript':85 'key':71 'librari':7 'maintain':54 'name':32 'node.js':65 'number':35,38 'pattern':27 'person':10 'phone':34 'pii':13,30 'piiranha':1,2 'provid':17 'redact':46 'regex':26,82 'remov':9 'replac':49,77 'rule':47 'solvvy/redact-pii':57 'ssns':41 'support':44 'sync/async':74 'synchron':19 'test':63 'text':15 'type':31 'typescript':6,86 'v3.5.8':3 'valu':50 'via':80 'x':67,70","created_at":"2026-06-04T18:53:48.188006+00:00","updated_at":"2026-06-04T18:53:48.188006+00:00","problems":[{"fix":"Use import syntax, or in Node.js set \"type\": \"module\" in package.json, or use a transpiler like esbuild or webpack.","cause":"Package is ESM-only; commonjs require not supported without bundler transforms.","error":"SyntaxError: Cannot use import statement outside a module"},{"fix":"Use SyncRedactor with redact() and AsyncRedactor with redactAsync().","cause":"Using sync redactor's redactAsync (does not exist) or async redactor's redact (sync) incorrectly.","error":"TypeError: redactor.redactAsync(...).then is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/NointidWorks/piiranha#readme","github":"https://github.com/NointidWorks/piiranha","docs":null,"changelog":null,"pypi":null,"npm":"piiranha","openapi_spec":null,"status_page":null,"smithery":null,"categories":["security"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}