lib/chord.js
function (chord) {
  var noteRegex = '[A-Ga-g][#b]{0,2}';
  var root = chord.match(new RegExp('^' + noteRegex))[0];
  var bass = null;
  var symbol;

  root = note.create(root);

  // Strip note, strip spaces, strip bass
  symbol = chord.replace(/[\s]/g, '')
                .replace(new RegExp('^' + noteRegex), '')
                .replace(new RegExp('/' + noteRegex + '$'), '');

  bass = chord.match(new RegExp('/' + noteRegex + '$'));
  if (bass) bass = note.create(bass[0].slice(1));

  return { root: root, symbol: symbol, bass: bass };
}
function (chord) {
  var noteRegex = '[A-Ga-g][#b]{0,2}';
  var root = chord.match(new RegExp('^' + noteRegex))[0];
  var bass = null;
  var symbol;

  root = note.create(root);

  // Strip note, strip spaces, strip bass
  symbol = chord.replace(/[\s]/g, '')
                .replace(new RegExp('^' + noteRegex), '')
                .replace(new RegExp('/' + noteRegex + '$'), '');

  bass = chord.match(new RegExp('/' + noteRegex + '$'));
  if (bass) bass = note.create(bass[0].slice(1));

  return { root: root, symbol: symbol, bass: bass };
}
function ( chord ) { var noteRegex = '[A-Ga-g][#b]{0,2}' ; var root = chord . match ( new RegExp ( '^' + noteRegex ) ) [ 0 ] ; var bass = null ; var symbol ; root = note . create ( root ) ; // Strip note, strip spaces, strip bass symbol = chord . replace ( / [\s] / g , '' ) . replace ( new RegExp ( '^' + noteRegex ) , '' ) . replace ( new RegExp ( '/' + noteRegex + '$' ) , '' ) ; bass = chord . match ( new RegExp ( '/' + noteRegex + '$' ) ) ; if ( bass ) bass = note . create ( bass [ 0 ] . slice ( 1 ) ) ; return { root : root , symbol : symbol , bass : bass } ; }
Parse a chord symbol and return root, chord, bass
Parse a chord symbol and return root chord bass