Skip to content

v0.18.0 - Add redact() function

Choose a tag to compare

@Zheruel Zheruel released this 30 Sep 23:24
· 27 commits to main since this release
9625234

Added

  • New Function: redact() - Redact sensitive information from text for UI/logging purposes
    • Built-in pattern support for SSN, credit cards, emails, and phone numbers
    • Multiple redaction strategies: partial (show last N chars) and full (complete masking)
    • Selective type redaction - choose which data types to redact
    • Custom pattern support with regex and replacement functions
    • Configurable partial length (default: 4 characters)
    • Smart format preservation for phone numbers (parentheses, dots, dashes)
    • Consistent output formatting (e.g., SSNs always use dash format)
    • Security notice in documentation emphasizing proper use cases
    • 42 comprehensive test cases covering all redaction types and edge cases
    • Bundle size: ~1.3KB gzipped

Changed

  • Bundle Size - Increased size limit from 9 KB to 9.1 KB to accommodate new redaction function
  • Documentation - Updated function count from 47 to 48 functions
  • Interactive Playground - Added redact() to documentation site with live examples

Install

npm install nano-string-utils@0.18.0

View the full changelog: https://github.com/Zheruel/nano-string-utils/blob/main/CHANGELOG.md