if else
участок )?const concatenateEditionFields = (
pack: PackType,
edition: IEditionMetadata,
fieldName: string
) => {
const packField = pack[fieldName]
const editionField = edition[fieldName]
const concatenated = `${packField || ''}${' '}${editionField ||
''}`.trimLeft()
const isLanguageEqual =
!edition.language || edition.language === pack.language
if (isLanguageEqual) {
return concatenated
} else if (!isLanguageEqual && fieldName === 'slugline') {
if (edition.addToPackSlug) {
return concatenated
} else {
return editionField
}
} else {
return editionField
}
}
const concatenateEditionFields = (
pack: PackType,
edition: IEditionMetadata,
fieldName: string
) => {
const packField = pack[fieldName] || '',
editionField = edition[fieldName] || '',
concatenated = `${packField} ${editionField}`.trimLeft(),
isLanguageEqual = !edition.language || edition.language === pack.language
if (isLanguageEqual) {
return concatenated
} else if (fieldName === 'slugline') {
return edition.addToPackSlug ? concatenated : editionField
}
return editionField
}
return isLanguageEqual ? concatenated : fieldName === 'slugline' ? edition.addToPackSlug ? concatenated : editionField : editionField