3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

Simplify containsOnlyNormalChars() test

This commit is contained in:
Dragory 2020-08-28 00:25:24 +03:00
parent 786c2e3d86
commit 35b32e00be
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -150,11 +150,10 @@ const REPLACED_CHARS: Record<string, RegExp> = Array.from(Object.entries(REPLACE
{}, {},
); );
const NORMAL_CHARS_REGEX = /[a-z2689:.\-_+()*&^%><;"'}{~,]+/gim; const NORMAL_CHARS_REGEX = /^[a-z2689:.\-_+()*&^%><;"'}{~,]+$/i;
function containsOnlyNormalChars(text: string) { function containsOnlyNormalChars(text: string) {
const match = text.match(NORMAL_CHARS_REGEX); return NORMAL_CHARS_REGEX.test(text);
return match && match[0].length === text.length;
} }
/** /**