I have a dict containing a name in two parts:
target = {
"givenName": "Elvis",
"middleName": "Aron",
}
middleName is optional. I need to map to them one string, which is either givenName + ' ' + middleName if middleName is defined or just firstName. What is the canonical way to do this using glom?
The solution I've found so far is to use
lambdaandCoalesce. The below solution will work whethermiddleNameis included or not: