fix profile and start/end dates missing in rxresume converter

This commit is contained in:
Reorx 2023-02-04 20:50:38 +08:00
parent a9cbab662e
commit 9ee72220d1
1 changed files with 15 additions and 5 deletions

View File

@ -116,6 +116,13 @@ function convert(source) {
}) })
// basics.profiles // basics.profiles
if (source.basics.profiles) {
result.basics.profiles = source.basics.profiles.map(profile => {
const newProfile = {...profile}
delete newProfile.id
return newProfile
})
}
/* sections */ /* sections */
@ -211,14 +218,17 @@ function convertObject(obj, objMap, customFunc) {
// console.log(`convert ${JSON.stringify(obj)} by ${objMap}`) // console.log(`convert ${JSON.stringify(obj)} by ${objMap}`)
const result = {} const result = {}
for (const [key, conversion] of Object.entries(objMap)) { for (const [key, conversion] of Object.entries(objMap)) {
const value = objectPath.get(obj, key)
if (value === undefined) continue
if (value === "") continue
if (typeof conversion === 'string') { if (typeof conversion === 'string') {
result[conversion] = value const value = objectPath.get(obj, conversion)
if (value === undefined || value === "") continue
result[key] = value
} else if (typeof conversion === 'object') { } else if (typeof conversion === 'object') {
result[conversion.key] = convertObject(value, conversion.conversion) const value = objectPath.get(obj, conversion.key)
if (!value) continue
result[key] = convertObject(value, conversion.conversion)
} }
} }
if (customFunc) if (customFunc)