

function xx(element, input) {
const detailData = JSON.parse(input.body).zpData.geekDetailInfo
const educationList = detailData.geekEduExpList
const sortedEducationList = educationList.sort((a, b) => {
const dateA = parseInt(a.startDate, 10);
const dateB = parseInt(b.startDate, 10);
return dateA - dateB;
});
const formattedEntries = sortedEducationList.map(entry => {
const { school, major, degreeName, tags } = entry;
const tagsString = tags && tags.length > 0 ? ` (${tags.join(', ')})` : '';
return `${school} - ${major} (${degreeName})${tagsString}`;
});
const education = formattedEntries.join('\n')
const workExperiences = detailData.geekWorkExpList
const formattedWorkExperiences = workExperiences.map(experience => {
const {
company,
positionName,
startYearMonStr,
endYearMonStr,
workYearDesc,
responsibility
} = experience;
// Format the date range
const dateRange = `${startYearMonStr}-${endYearMonStr}`;
// Combine all the required fields into a single string
return `${company} - ${positionName}\n${dateRange} (${workYearDesc})\n职责:\n${responsibility}`;
});
const outputData = {
age:detailData.geekBaseInfo.ageDesc,
liveness:detailData.geekBaseInfo.activeTimeDesc,
education: education,
work:formattedWorkExperiences,
}
return outputData ;
}