From 0b2a982ca3eac962f56f2c2dac4a16764376294e Mon Sep 17 00:00:00 2001 From: grainsoft Date: Wed, 3 Dec 2025 01:38:07 +0200 Subject: [PATCH] updates --- src/utils/AppendOptions.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/utils/AppendOptions.js b/src/utils/AppendOptions.js index 2871269..64a5cee 100644 --- a/src/utils/AppendOptions.js +++ b/src/utils/AppendOptions.js @@ -10,8 +10,17 @@ export class AppendOptions { this.replaceChildren(); } - Ut.each(Ut.isStr(data) - ? data.replace(/"((?:\\.|[^"\\])*)"\s*:\s*"((?:\\.|[^"\\])*)"/g, (_, rawKey, rawVal) => target.append(new Option(JSON.parse(`"${rawVal}"`), JSON.parse(`"${rawKey}"`) )) ) - : data, (val, id) => target.append(new Option(val, id)) ); + if (Ut.isStr(data)) { + data.replace(/"((?:\\.|[^"\\])*)"\s*:\s*"((?:\\.|[^"\\])*)"/g, (_, rawKey, rawVal) => target.append( + new Option( + JSON.parse(`"${rawVal}"`), + JSON.parse(`"${rawKey}"`) + ) + )); + + return; + } + + Ut.each(data, (val, id) => target.append(new Option(val, id)) ); } } \ No newline at end of file