feat: genre pages

This commit is contained in:
Cory Dransfeldt 2024-05-26 14:25:03 -07:00
parent f6ec72f469
commit 086a7bf6c9
No known key found for this signature in database
29 changed files with 165 additions and 67 deletions

View file

@ -1,3 +1,5 @@
import slugify from 'slugify'
export const shuffleArray = array => {
for (let i = array.length - 1; i > 0; i--) {
let j = Math.floor(Math.random() * (i + 1));
@ -6,4 +8,15 @@ export const shuffleArray = array => {
array[j] = temp;
}
return array
}
export const sanitizeMediaString = (str) => {
if (!str) return null
const sanitizedString = str.normalize('NFD').replace(/[\u0300-\u036f\u2010—\.\?\(\)\[\]\{\}]/g, '').replace(/\.{3}/g, '')
return slugify(sanitizedString, {
replacement: '-',
remove: /[#,&,+()$~%.'":*?<>{}]/g,
lower: true,
})
}