From 7ef14aabedae8c4a038943633c6b2c2ec52b067e Mon Sep 17 00:00:00 2001 From: snakehnb Date: Mon, 4 Nov 2024 16:13:14 +0800 Subject: [PATCH] Avoid parsing first and last names in Chinese, Japanese and Korean languages --- server/utils/parsers/parseNameString.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server/utils/parsers/parseNameString.js b/server/utils/parsers/parseNameString.js index 741beb09..4b16b496 100644 --- a/server/utils/parsers/parseNameString.js +++ b/server/utils/parsers/parseNameString.js @@ -52,6 +52,13 @@ module.exports.parse = (nameString) => { } if (splitNames.length) splitNames = splitNames.map((a) => a.trim()) + // If names are in Chineseļ¼ŒJapanese and Korean languages, return as is. + if (/[\u4e00-\u9fff\u3040-\u30ff\u31f0-\u31ff]/.test(splitNames[0])) { + return { + names: splitNames + } + } + var names = [] // 1 name FIRST LAST