How to map an array when the objects don't have the same features ?

I try to map an array of objects to a simple array but sometimes the objects don’t have the same features.

For instance, some objects have a value of “father” or “mother”. How can I map the array of objects to the simple array with no value if father doesn’t exist in the original object ?

Here is the Observable notebook with the example: Example / PAC | Observable

You can either make your mapping function resilient to missing values, or you can remove data points that don’t match the expected format. I’ve shown an example of both methods in this fork of your notebook:


Thank you so much for your answer.

I prefer the first option in my use case.