#mask #thanks #mask-text

mask-text

This is a library to mask text with multiple masking options

3 releases

0.1.2 Nov 1, 2022
0.1.1 Nov 1, 2022
0.1.0 Nov 1, 2022

#1043 in Text processing

Download history 57/week @ 2024-12-10 17/week @ 2024-12-17 9/week @ 2024-12-24 6/week @ 2025-01-07 7/week @ 2025-01-14 10/week @ 2025-01-21 7/week @ 2025-01-28 16/week @ 2025-02-04 15/week @ 2025-02-11 1/week @ 2025-02-18 32/week @ 2025-02-25 155/week @ 2025-03-04 930/week @ 2025-03-11 778/week @ 2025-03-18 874/week @ 2025-03-25

2,750 downloads per month
Used in safeshell

Apache-2.0

9KB
127 lines

mask-text

Crates.io CI

This is a library to mask text with multiple masking options

Usage

[dependencies]
mask-text = { version = "0.1.2" }

Mask Options

  • Percentage
  • Regex
  • Prefix
  • All

Examples


fn main() {
    // masking 80% of the given text. minimum masking chars should bigger then 3.
    let percentage_result = mask_text::Kind::Percentage("text to mask".to_string(), 80, 3, "*".to_string()).mask();

    // masking text by regex group.
    let re = Regex::new("([a-z].*) (mask) ([a-z].*)").unwrap();
    let regex_result = mask_text::Kind::Regex("text to mask on group".to_string(), re, 2, "*".to_string()).mask();
    
    // masking 3 first chars from the string.
    let prefix_result = mask_text::Kind::Prefix("text to mask".to_string(), 3, "*".to_string()).mask();

    // masking all chars.
    let all_result = mask_text::Kind::All("text to mask".to_string(), "*".to_string()).mask()
}

All the examples here

Thanks

To all Contributors - you make this happen, thanks!

Copyright (c) 2022 @kaplanelad. See LICENSE for further details.

Dependencies

~2.2–3MB
~54K SLoC