Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prettify masked values [HELP NEEDED] [FEATURE REQUEST] #50

Open
RichardsonWTR opened this issue Jul 13, 2021 · 0 comments
Open

Prettify masked values [HELP NEEDED] [FEATURE REQUEST] #50

RichardsonWTR opened this issue Jul 13, 2021 · 0 comments

Comments

@RichardsonWTR
Copy link

The problem

By default the non numeric characters are removed from the string.
I need to pretty print masked phones and CEPs. How can I do it?

Possible solution

Example of possible implementation

formatToCEP('15998030')
//=> '15998-030'
 
formatToCEP('****8030', { masked: true })
//=> '****8-030'

formatToPhone('11971626799') 
//=> '(11) 9 7162-6799'

formatToPhone('*******6799', { masked: true })
//=> '(**) * ****-6799'

The new method signature could be as follows:

formatToCEP(value, { masked = false, mask_digit = '*' })
formatToPhone(value, { masked  = false, mask_digit = '*' })
@RichardsonWTR RichardsonWTR changed the title Is there any possibility of masking the values? [HELP NEEDED] [FEATURE REQUEST] Prettify masked values [HELP NEEDED] [FEATURE REQUEST] Jul 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant