@@ -689,23 +689,18 @@ function BestFitFormatMatcher (options, formats) {
689
689
// 4. Let delta be max(min(formatPropIndex - optionsPropIndex, 2), -2).
690
690
let delta = Math . max ( Math . min ( formatPropIndex - optionsPropIndex , 2 ) , - 2 ) ;
691
691
692
- {
693
- // diverging from spec
694
- // When the bestFit argument is true, subtract additional penalty where data types are not the same
695
- if ( ( formatPropIndex <= 1 && optionsPropIndex >= 2 ) || ( formatPropIndex >= 2 && optionsPropIndex <= 1 ) ) {
696
- // 5. If delta = 2, decrease score by longMorePenalty.
697
- if ( delta > 0 )
698
- score -= longMorePenalty ;
699
- else if ( delta < 0 )
700
- score -= longLessPenalty ;
701
- } else {
702
- // 5. If delta = 2, decrease score by longMorePenalty.
703
- if ( delta > 1 )
704
- score -= shortMorePenalty ;
705
- else if ( delta < - 1 )
706
- score -= shortLessPenalty ;
707
- }
708
- }
692
+ // 5. If delta = 2, decrease score by longMorePenalty.
693
+ if ( delta === 2 )
694
+ score -= longMorePenalty ;
695
+ // 6. Else if delta = 1, decrease score by shortMorePenalty.
696
+ else if ( delta === 1 )
697
+ score -= shortMorePenalty ;
698
+ // 7. Else if delta = -1, decrease score by shortLessPenalty.
699
+ else if ( delta === - 1 )
700
+ score -= shortLessPenalty ;
701
+ // 8. Else if delta = -2, decrease score by longLessPenalty.
702
+ else if ( delta === - 2 )
703
+ score -= longLessPenalty ;
709
704
}
710
705
}
711
706
0 commit comments