Sumukha1496 / maskdata

maskdata is a node.js module to mask various kinds of data
MIT License
92 stars 7 forks source link

Feature Request: Masking email address even if it doesn't have '@' #33

Open RezaRahmati opened 1 year ago

RezaRahmati commented 1 year ago

Given an email address that doesn't have @ will result to the below error

Bad config value : {"where":"Email mask configuration","reasons":["Email must contain one '@'"]}

Wondering if we can add an option to ignore the invalid emails, and mask data till the end. for example with given below config

{
    maskWith: '*',
    unmaskedStartCharactersBeforeAt: 2,
    unmaskedEndCharactersAfterAt: 1,
    invalidEmailAddressBehavior: 'mask' // values can be 'ignore', 'error', 'mask'
}

and given this email address reza.com, it would return re****** and if value of invalidEmailAddressBehavior is equal to ignore , it would return reza.com (the original value without masking)

Sumukha1496 commented 1 year ago

Hi Reza, let me go through the requirement. I will come back to you soon with the update