Skip to content

Commit

Permalink
Improvements to cleanTitle function
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzeman committed Mar 18, 2020
1 parent 6a645be commit ac83f04
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Utilities/Metadata.js
Expand Up @@ -28,9 +28,11 @@ export function cleanTitle(value) {
}

return value
.replace(/&/g, 'and') // Replace ampersand with "and"
.replace(/[^\w\s]/gi, '') // Remove special characters
.replace(/\s+/g, ' ') // Remove extra spaces
.replace(/&/g, 'and') // Replace ampersand with "and"
.replace(/pt\./gi, 'part') // Replace "pt." with "part"
.replace(/ft\./gi, 'featuring') // Replace "pt." with "part"
.replace(/[^\w\s]/gi, '') // Remove special characters
.replace(/\s+/g, ' ') // Remove extra spaces
.toLowerCase()
.trim();
}
Expand Down

0 comments on commit ac83f04

Please sign in to comment.