code: function (interval) {
    var quality;
    var number;
  
    if (interval instanceof Interval) return interval;
  
    quality = interval.replace(/\d/g, ''); // Remove digits
    number = parseInt(interval.replace(/\D/g, ''), 10); // Remove non-digits
  
    if (!quality) { // No quality given, assume major or perfect
      quality = isPerfect(number) ? 'P' : 'M';
    }
  
    return new Interval(number, quality);
  }
docs: Parse a string and return an interval object