handle edge case for short key strings

This commit is contained in:
kitajchuk
2022-08-25 09:05:22 -07:00
committed by Brandon Lee Kitajchuk
parent 28d9bbf98e
commit ec73bcef53
+4
View File
@@ -19,6 +19,10 @@ const obscureKey = (key) => {
const key_spoiler_length = 6;
const key_spoiler_char = 'X';
if (key.length <= key_spoiler_length) {
return key;
}
return `${key.slice(0, key_spoiler_length)}${key_spoiler_char.repeat(key.length - key_spoiler_length)}`;
};