How to use chordjs - 4 common examples

To help you get started, we’ve selected a few chordjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github martijnversluis / ChordFiddle / js / chord_pro_editor.js View on Github external
processChord(item, processor) {
    if (item instanceof ChordSheetJS.ChordLyricsPair && item.chords) {
      const parsedChord = Chord.parse(item.chords);

      if (parsedChord) {
        item.chords = processor(parsedChord).toString();
      }
    }
  }
github martijnversluis / ChordFiddle / src / utils / chord_sheet_transformations.js View on Github external
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;
};
github artutra / OpenChord / app / components / SongTransformer.tsx View on Github external
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;
};
github artutra / OpenChord / app / components / SongTransformer.tsx View on Github external
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)
            }
          })
        }
      }
    })
  })

chordjs

A simple JavaScript chord parsing and manipulation tool

GPL-2.0
Latest version published 3 years ago

Package Health Score

42 / 100
Full package analysis

Popular chordjs functions