feat: paginate watching pages + music updates
This commit is contained in:
parent
9c0f47278c
commit
0d926fd844
25 changed files with 141 additions and 90 deletions
|
@ -19,4 +19,21 @@ export const sanitizeMediaString = (str) => {
|
|||
remove: /[#,&,+()$~%.'":*?<>{}]/g,
|
||||
lower: true,
|
||||
})
|
||||
}
|
||||
|
||||
export const regionNames = new Intl.DisplayNames(['en'], { type: 'region' })
|
||||
|
||||
export const getCountryName = (countryCode) => regionNames.of(countryCode.trim()) || countryCode.trim()
|
||||
|
||||
export const parseCountryField = (countryField) => {
|
||||
if (!countryField) return null
|
||||
|
||||
const delimiters = [',', '/', '&', 'and']
|
||||
let countries = [countryField]
|
||||
|
||||
delimiters.forEach(delimiter => {
|
||||
countries = countries.flatMap(country => country.split(delimiter))
|
||||
})
|
||||
|
||||
return countries.map(getCountryName).join(', ')
|
||||
}
|
Reference in a new issue