fix(reactflowUtils.ts): modify convertValuesToNumbers function to correctly handle values that are numbers represented as strings

feat(reactflowUtils.ts): add check to convertValuesToNumbers function to only convert values that are valid numbers represented as strings
This commit is contained in:
cristhianzl 2023-10-18 15:44:24 -03:00
commit a7eab9677f

View file

@ -436,8 +436,8 @@ export function convertValuesToNumbers(arr) {
for (const key in obj) {
if (obj.hasOwnProperty(key)) {
let value = obj[key];
if (/\s/g.test(value)) {
value = value.trim();
if (/^\d+$/.test(value)) {
value = value?.toString().trim();
}
newObj[key] =
value === "" || isNaN(value) ? value.toString() : Number(value);