feat: genre pages
This commit is contained in:
parent
f6ec72f469
commit
086a7bf6c9
29 changed files with 165 additions and 67 deletions
|
@ -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,
|
||||
})
|
||||
}
|
Reference in a new issue