1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
export function formatResume(resumeDetails) {
function applyFormatting(text) {
if (typeof text === 'string') {
return text
.replace(/\*([^*]+)\*/g, '<strong>$1</strong>')
.replace(/_([^_]+)_/g, '<em>$1</em>');
}
return text;
}
function preprocessResumeDetails(details) {
if (Array.isArray(details)) {
return details.map(item => preprocessResumeDetails(item));
} else if (typeof details === 'object' && details !== null) {
const newDetails = {};
for (const key in details) {
if (details.hasOwnProperty(key)) {
newDetails[key] = preprocessResumeDetails(details[key]);
}
}
return newDetails;
} else {
return applyFormatting(details);
}
}
return preprocessResumeDetails(resumeDetails);
}