code: function (beats, subunits) {
    // Number of beats
    this.beats = beats || 0;
  
    // Acceptable values: sixteenth, eighth, longEighth, shortEighth, triplet
    this.subunits = subunits || [];
  
    _.each(this.subunits, function (subunit) {
      if (!_.contains(['sixteenth', 'eighth', 'longEighth', 'shortEighth', 'triplet'], subunit)) {
        throw new Error('Invalid duration subunit: ' + subunit);
      }
    });
  }
docs: A duration must have either a number of beats or an array of subunits, and it can have both e.g. new Duration(2, ['eighth', 'sixteenth']) is a half note tied to a dotted eighth