How can I make this code more elegant and concise?
Observable.of(
{field: "title"},
{field: "referenceId", key: "refid"},
{field: "app"},
{field: "user"},
{field: "action"},
{field: "expiresAt", key: "expiration"},
{field: "timestamp"}
)
.pipe(
map(field => {
if (!field.key) {
return { ...field, key: field.field, sorteable: true };
}
else {
return { ...field, sorteable: true };
}
})
);