mirror of
https://gitlab.com/RemixDev/deemix-js.git
synced 2025-01-16 03:06:39 +00:00
Add more cases for feat. removal
This commit is contained in:
parent
b383190a34
commit
6631daff21
|
@ -40,10 +40,20 @@ function changeCase(txt, type){
|
||||||
|
|
||||||
function removeFeatures(title){
|
function removeFeatures(title){
|
||||||
let clean = title
|
let clean = title
|
||||||
if (clean.search(/\(feat\./gi) != -1){
|
let found = false
|
||||||
const pos = clean.search(/\(feat\./gi)
|
let pos
|
||||||
|
if (clean.search(/[\s(]?feat\.?\s/gi) != -1){
|
||||||
|
pos = clean.search(/[\s(]?feat\.?\s/gi)
|
||||||
|
found = true
|
||||||
|
}
|
||||||
|
if (clean.search(/[\s(]?ft\.?\s/gi) != -1){
|
||||||
|
pos = clean.search(/[\s(]?ft\.?\s/gi)
|
||||||
|
found = true
|
||||||
|
}
|
||||||
|
const openBracket = clean[pos] == '('
|
||||||
|
if (found) {
|
||||||
let tempTrack = clean.slice(0, pos)
|
let tempTrack = clean.slice(0, pos)
|
||||||
if (clean.includes(')'))
|
if (clean.includes(')') && openBracket)
|
||||||
tempTrack += clean.slice(clean.indexOf(')', pos+1)+1)
|
tempTrack += clean.slice(clean.indexOf(')', pos+1)+1)
|
||||||
clean = tempTrack.trim()
|
clean = tempTrack.trim()
|
||||||
clean = clean.replace(/\s\s+/g, ' ') // remove extra spaces
|
clean = clean.replace(/\s\s+/g, ' ') // remove extra spaces
|
||||||
|
|
Loading…
Reference in a new issue