Last active
July 18, 2018 11:01
-
-
Save leonidkuznetsov18/9949272fe29f0574038e3dd695065be1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// return masked string | |
function maskify(cc) { | |
return cc.replace(/.(?=.{4})/g, "#"); | |
} | |
// or | |
function maskify(cc) { | |
return cc.replace(/.(?=....)/g, '#'); | |
} | |
// or | |
function maskify(cc) { | |
return cc.slice(0, -4).replace(/./g, '#') + cc.slice(-4); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment