Compare commits

..

No commits in common. "95769adf879770972642244a2566f014a31bee74" and "2422ea3a5da895ac144449f2dfdfeb247b8b7b1f" have entirely different histories.

View file

@ -22,8 +22,19 @@ const { date2Thai, messageError } = useCounterMixin();
function removeDuplicateWords(text: string): string {
if (!text) return text;
//
const words = text.split(/(?=[ก-๙])/);
const result: string[] = [];
for (let i = 0; i < words.length; i++) {
const word = words[i];
if (i === 0 || word !== words[i - 1]) {
result.push(word);
}
}
// : regex
return text.replace(/([ก-๙]{2,})\1+/g, "$1");
return text.replace(/([ก-๙]+)\1+/g, "$1");
}
/** รับ props มาจากหน้าหลัก */