Refactor code structure for improved readability and maintainability
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 53s
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 53s
This commit is contained in:
12
backend/utils/drawingData.js
Normal file
12
backend/utils/drawingData.js
Normal file
@@ -0,0 +1,12 @@
|
||||
export function normalizeStoredDrawingData(value) {
|
||||
if (!value) return null;
|
||||
let normalized = value;
|
||||
for (let pass = 0; pass < 2 && typeof normalized === 'string'; pass += 1) {
|
||||
try {
|
||||
normalized = JSON.parse(normalized);
|
||||
} catch (error) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return typeof normalized === 'string' ? normalized : JSON.stringify(normalized);
|
||||
}
|
||||
Reference in New Issue
Block a user