simpler solution to mask using padStart

This commit is contained in:
Theo Menkes Reis
2018-09-25 00:21:18 +00:00
parent 9e6c789bea
commit 77167a059d
2 changed files with 3 additions and 4 deletions

View File

@ -1,3 +1,3 @@
const mask = (cc, num = 4, mask = '*') =>
('' + cc).slice(0, -num).replace(/./g, mask) + ('' + cc).slice(-num);
('' + cc).slice(-num).padStart(('' + cc).length, mask);
module.exports = mask;