lib/chord.js
function (scales, chord) {
  // Exclude scales with a particular interval
  var exclude = function (int) {
    scales = _.filter(scales, function (scale) {
      return !scale.hasInterval(int);
    });
  };

  // Add a scale at a particular index
  var include = function (index, scaleId) {
    scales.splice(index, 0, scale.create(chord.root, scaleId));
  };

  if (_.includes(['m', 'm6', 'm7', 'm9', 'm11', 'm13'], chord.formattedSymbol)) {
    exclude('M3');
  }
  if (_.includes(['7', '9', '11', '13', 'm7', 'm9', 'm11', 'm13'], chord.formattedSymbol)) {
    exclude('M7');
  }
  if (_.includes(['M7', 'M9', 'M11', 'M13'], chord.formattedSymbol)) {
    exclude('m7');
  }
  if (chord.formattedSymbol[0] === '6' || chord.formattedSymbol.slice(0, 2) === 'M6') {
    exclude('m7');
  }

  if (_.includes(['7', '7#9', '7+9', '7#11', '7+11'], chord.formattedSymbol)) {
    include(2, 'blues');
  }

  return scales;
}
function (scales, chord) {
  // Exclude scales with a particular interval
  var exclude = function (int) {
    scales = _.filter(scales, function (scale) {
      return !scale.hasInterval(int);
    });
  };

  // Add a scale at a particular index
  var include = function (index, scaleId) {
    scales.splice(index, 0, scale.create(chord.root, scaleId));
  };

  if (_.includes(['m', 'm6', 'm7', 'm9', 'm11', 'm13'], chord.formattedSymbol)) {
    exclude('M3');
  }
  if (_.includes(['7', '9', '11', '13', 'm7', 'm9', 'm11', 'm13'], chord.formattedSymbol)) {
    exclude('M7');
  }
  if (_.includes(['M7', 'M9', 'M11', 'M13'], chord.formattedSymbol)) {
    exclude('m7');
  }
  if (chord.formattedSymbol[0] === '6' || chord.formattedSymbol.slice(0, 2) === 'M6') {
    exclude('m7');
  }

  if (_.includes(['7', '7#9', '7+9', '7#11', '7+11'], chord.formattedSymbol)) {
    include(2, 'blues');
  }

  return scales;
}
function ( scales , chord ) { // Exclude scales with a particular interval var exclude = function ( int ) { scales = _ . filter ( scales , function ( scale ) { return ! scale . hasInterval ( int ) ; } ) ; } ; // Add a scale at a particular index var include = function ( index , scaleId ) { scales . splice ( index , 0 , scale . create ( chord . root , scaleId ) ) ; } ; if ( _ . includes ( [ 'm' , 'm6' , 'm7' , 'm9' , 'm11' , 'm13' ] , chord . formattedSymbol ) ) { exclude ( 'M3' ) ; } if ( _ . includes ( [ '7' , '9' , '11' , '13' , 'm7' , 'm9' , 'm11' , 'm13' ] , chord . formattedSymbol ) ) { exclude ( 'M7' ) ; } if ( _ . includes ( [ 'M7' , 'M9' , 'M11' , 'M13' ] , chord . formattedSymbol ) ) { exclude ( 'm7' ) ; } if ( chord . formattedSymbol [ 0 ] === '6' || chord . formattedSymbol . slice ( 0 , 2 ) === 'M6' ) { exclude ( 'm7' ) ; } if ( _ . includes ( [ '7' , '7#9' , '7+9' , '7#11' , '7+11' ] , chord . formattedSymbol ) ) { include ( 2 , 'blues' ) ; } return scales ; }
Given an ordered list of scales and a chord symbol, optimize order
Given an ordered list of scales and a chord symbol optimize order