Commit 128699b0 authored by deb355529's avatar deb355529 Committed by Oyvind
Browse files

DEICH-5885: deichman.no: flatMap to map().reduce()

parent 443ae8a4
......@@ -133,13 +133,14 @@ export default function ReservePublicationWidget({
showFields.includes("language") &&
!notReservableReason(pub, copies)
)
.flatMap(({ languages = [] }) =>
.map(({ languages = [] }) =>
languages.map(language => ({
key: language,
value: language,
text: TRANSLATIONS[language]
}))
),
)
.reduce((a, b) => a.concat(b), []),
"value"
)
},
......@@ -156,13 +157,14 @@ export default function ReservePublicationWidget({
showFields.includes("format") &&
!notReservableReason(pub, copies)
)
.flatMap(({ formats = [] }) =>
.map(({ formats = [] }) =>
formats.map(format => ({
key: format,
value: format,
text: TRANSLATIONS[format]
}))
),
)
.reduce((a, b) => a.concat(b), []),
"value"
)
},
......@@ -178,13 +180,14 @@ export default function ReservePublicationWidget({
showFields.includes("platform") &&
!notReservableReason(pub, copies)
)
.flatMap(({ platforms = [] }) =>
.map(({ platforms = [] }) =>
platforms.map(platform => ({
key: platform,
value: platform,
text: TRANSLATIONS[platform]
}))
),
)
.reduce((a, b) => a.concat(b), []),
"value"
)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment