mirror of
https://gitlab.com/RemixDev/deemix-js.git
synced 2025-01-01 12:25:59 +00:00
Implemented changeCase function
This commit is contained in:
parent
77e6ce0da4
commit
0d7bb116d3
|
@ -18,6 +18,19 @@ function generateReplayGainString(trackGain){
|
||||||
return `${Math.round((parseFloat(trackGain) + 18.4)*-100)/100} dB`
|
return `${Math.round((parseFloat(trackGain) + 18.4)*-100)/100} dB`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function changeCase(txt, type){
|
||||||
|
switch (type) {
|
||||||
|
case 'lower': return txt.toLowerCase()
|
||||||
|
case 'upper': return txt.toUpperCase()
|
||||||
|
case 'start':
|
||||||
|
txt = txt.split(" ")
|
||||||
|
for (let i = 0; i < txt.length; i++) txt[i] = txt[i][0].toUpperCase() + txt[i].substr(1).toLowerCase()
|
||||||
|
return txt.join(" ")
|
||||||
|
case 'sentence': return txt.charAt(0).toUpperCase() + txt.slice(1).toLowerCase()
|
||||||
|
default: return txt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function removeFeatures(title){
|
function removeFeatures(title){
|
||||||
let clean = title
|
let clean = title
|
||||||
if (clean.search(/\(feat\./gi) != -1){
|
if (clean.search(/\(feat\./gi) != -1){
|
||||||
|
@ -74,5 +87,6 @@ module.exports = {
|
||||||
uniqueArray,
|
uniqueArray,
|
||||||
removeDuplicateArtists,
|
removeDuplicateArtists,
|
||||||
pipeline,
|
pipeline,
|
||||||
canWrite
|
canWrite,
|
||||||
|
changeCase
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue