Replace join by Intl object

This commit is contained in:
Cédric FAMIBELLE-PRONZOLA
2022-02-05 14:21:56 +04:00
parent 3f487c5aa4
commit a7a9b15b59
6 changed files with 13 additions and 6 deletions
+4 -1
View File
@@ -5,7 +5,10 @@ import {jwennTeksEpiSlug, jwennTeks, jwennKomanteEpiTeksId} from '../../lib/oki-
import TeksDrawer from '../../components/teks/teks-drawer'
import HeadLayout from '../../components/head-layout'
const jwennAwtis = awtis => awtis.map(a => a.alias).join(', ')
const jwennAwtis = awtis => {
const alias = awtis.map(({alias}) => alias)
return new Intl.ListFormat('fr').format(alias)
}
export default function SlugTeks({teks, anTeks, slug, komante}) {
const awtis = anTeks.awtis.length === 1 ? anTeks.awtis[0].alias : jwennAwtis(anTeks.awtis)