Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
processChord(item, processor) {
if (item instanceof ChordSheetJS.ChordLyricsPair && item.chords) {
const parsedChord = Chord.parse(item.chords);
if (parsedChord) {
item.chords = processor(parsedChord).toString();
}
}
}
const processChord = (item, processor) => {
if (item instanceof ChordSheetJS.ChordLyricsPair && item.chords) {
const parsedChord = Chord.parse(item.chords);
if (parsedChord) {
const processedChordLyricsPair = item.clone();
processedChordLyricsPair.chords = processor(parsedChord).toString();
return processedChordLyricsPair;
}
}
return item;
};
const processChord = (item: (ChordSheetJS.ChordLyricsPair | ChordSheetJS.Tag), processor: (parsedChord: Chord) => Chord) => {
if (item instanceof ChordSheetJS.ChordLyricsPair) {
if (item.chords) {
const parsedChord = Chord.parse(item.chords);
if (parsedChord) {
const processedChordLyricsPair = item.clone();
processedChordLyricsPair.chords = processor(parsedChord).toString();
return processedChordLyricsPair;
}
}
} else {
if (item.name == 'comment' && item.value) {
let commentSong = new ChordSheetJS.ChordProParser().parse(item.value)
commentSong = transformSong(commentSong, processor);
item.value = new ChordSheetJS.ChordProFormatter().format(commentSong)
}
}
return item;
};
line.items.forEach(item => {
if (item instanceof ChordSheetJS.ChordLyricsPair) {
if (item.chords) {
const parsedChord = Chord.parse(item.chords);
if (parsedChord != null && allChords.find(c => c.toString() == parsedChord.toString()) == null) {
allChords.push(parsedChord)
}
}
} else {
if (item.name == 'comment' && item.value) {
let commentSong = new ChordSheetJS.ChordProParser().parse(item.value)
getChords(commentSong).forEach(c => {
if (!allChords.some(ac => ac.toString() == c.toString())) {
allChords.push(c)
}
})
}
}
})
})