Signature
Parameters
config (optional)
string
default:"'pseudonymize'"
Anonymization mode:
'pseudonymize'— Reversible. Returns an encryptedpiiMapfor later rehydration.'anonymize'— Irreversible. NopiiMapis returned; PII is permanently removed.
NERConfig
NER model configuration
SemanticConfig
Semantic enrichment configuration
KeyProvider
Encryption key provider. If not provided, generates a random key.
PIIStorageProvider
Storage provider for session-based PII map persistence
AnonymizationPolicy
Default anonymization policy
SecretsConfig
Secrets/credentials detection configuration
TagFormat
Tag format for PII placeholder tags. Controls the delimiters and keyword.
(warnings: Array<{ code: string; message: string }>) => void
Callback for validation warnings. When not provided, warnings are silently ignored — check
stats.leakScanPassed in the result instead.RecognizerRegistry
Custom recognizer registry (uses default if not provided)
Returns
AnAnonymizer instance with these methods:
Examples
Basic (Regex Only)
With NER
With Semantic Enrichment
With Storage
Irreversible Anonymization
With Inference Server
With Custom Tag Format
With Custom Thresholds
With Custom Policy
Excluding Countries and Regions
Related
- anonymize - The anonymize method
- Sessions - Session-based persistence
- Storage Providers - Available storage options