DEV: Fix "no-empty" lint (#24588)

This commit is contained in:
Jarek Radosz 2023-11-28 10:55:02 +01:00 committed by GitHub
parent 70dc6bcfd3
commit e9356c2ec9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,14 +6,17 @@ function insertSpoiler(_, spoiler) {
} }
function replaceSpoilers(text) { function replaceSpoilers(text) {
text = text || ""; text ||= "";
while ( let previousText;
text !==
(text = text.replace( do {
previousText = text;
text = text.replace(
/\[spoiler\]((?:(?!\[spoiler\]|\[\/spoiler\])[\S\s])*)\[\/spoiler\]/gi, /\[spoiler\]((?:(?!\[spoiler\]|\[\/spoiler\])[\S\s])*)\[\/spoiler\]/gi,
insertSpoiler insertSpoiler
)) );
) {} } while (text !== previousText);
return text; return text;
} }