Skip to content

Commit

Permalink
fix: error flattening (unwanted JSON parsing)
Browse files Browse the repository at this point in the history
  • Loading branch information
eartharoid committed Nov 16, 2024
1 parent f8d383a commit 9e9b044
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/lib/util/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ export function flatten(object) {
for (let [k, v] of Object.entries(object)) {
if (typeof v === 'string') {
try {
v = JSON.parse(v);
if (typeof v === 'object') {
v = flatten(v);
}
let j = JSON.parse(v);
if (typeof j === 'object') v = flatten(j);
else v = String(j)
} catch {
/* empty */
}
Expand All @@ -19,6 +18,5 @@ export function flatten(object) {
}
entries.push([k, v]);
}
console.log(entries);
return entries;
}

0 comments on commit 9e9b044

Please sign in to comment.