Update mask.md
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: mask
|
title: mask
|
||||||
tags: string,utility,regexp,intermediate
|
tags: string,utility,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Replaces all but the last `num` of characters with the specified mask character.
|
Replaces all but the last `num` of characters with the specified mask character.
|
||||||
@ -17,4 +17,4 @@ const mask = (cc, num = 4, mask = '*') => `${cc}`.slice(-num).padStart(`${cc}`.l
|
|||||||
mask(1234567890); // '******7890'
|
mask(1234567890); // '******7890'
|
||||||
mask(1234567890, 3); // '*******890'
|
mask(1234567890, 3); // '*******890'
|
||||||
mask(1234567890, -4, '$'); // '$$$$567890'
|
mask(1234567890, -4, '$'); // '$$$$567890'
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user