lib/chord.js
function (root, bass, intervals) {
  var chord = _.chain(intervals)
    .map(function (quality, number) {
      var int;
      if (quality) {
        // #9 is stored as b10, so special case this
        if (number === 10 && quality === 'm') {
          int = interval.create(9, 'aug');
        }
        else {
          int = interval.create(number, quality);
        }
        return root.transpose(int);
      }
    })
    .compact()
    .value();

  var bassIndex;

  // Handle slash chords
  if (bass && !root.enharmonic(bass)) {
    bassIndex = _.findIndex(chord, bass.enharmonic.bind(bass));

    if (bassIndex > -1) { // Rotate chord so bass is first
      chord = rotateArr(chord, bassIndex);
    }
    else { // Otherwise, add bass to beginning
      chord.unshift(bass);
    }
  }

  return chord;
}
function (root, bass, intervals) {
  var chord = _.chain(intervals)
    .map(function (quality, number) {
      var int;
      if (quality) {
        // #9 is stored as b10, so special case this
        if (number === 10 && quality === 'm') {
          int = interval.create(9, 'aug');
        }
        else {
          int = interval.create(number, quality);
        }
        return root.transpose(int);
      }
    })
    .compact()
    .value();

  var bassIndex;

  // Handle slash chords
  if (bass && !root.enharmonic(bass)) {
    bassIndex = _.findIndex(chord, bass.enharmonic.bind(bass));

    if (bassIndex > -1) { // Rotate chord so bass is first
      chord = rotateArr(chord, bassIndex);
    }
    else { // Otherwise, add bass to beginning
      chord.unshift(bass);
    }
  }

  return chord;
}
function ( root , bass , intervals ) { var chord = _ . chain ( intervals ) . map ( function ( quality , number ) { var int ; if ( quality ) { // #9 is stored as b10, so special case this if ( number === 10 && quality === 'm' ) { int = interval . create ( 9 , 'aug' ) ; } else { int = interval . create ( number , quality ) ; } return root . transpose ( int ) ; } } ) . compact ( ) . value ( ) ; var bassIndex ; // Handle slash chords if ( bass && ! root . enharmonic ( bass ) ) { bassIndex = _ . findIndex ( chord , bass . enharmonic . bind ( bass ) ) ; if ( bassIndex > - 1 ) { // Rotate chord so bass is first chord = rotateArr ( chord , bassIndex ) ; } else { // Otherwise, add bass to beginning chord . unshift ( bass ) ; } } return chord ; }
Return an array of notes in a chord
Return an array of notes in a chord