3636
3737
3838String . prototype . score = function ( abbreviation , offset ) {
39- offset = offset || 0 // TODO: I think this is unused... remove
39+ offset = offset || 0 ; // TODO: I think this is unused... remove
4040
4141 if ( abbreviation . length === 0 ) {
42- return 0.9
42+ return 0.9 ;
4343 }
4444 if ( abbreviation . length > this . length ) {
45- return 0.0
45+ return 0.0 ;
4646 }
4747
4848 for ( var i = abbreviation . length ; i > 0 ; i -- ) {
49- var sub_abbreviation = abbreviation . substring ( 0 , i )
50- var index = this . indexOf ( sub_abbreviation )
49+ var sub_abbreviation = abbreviation . substring ( 0 , i ) ;
50+ var index = this . indexOf ( sub_abbreviation ) ;
5151
5252
5353 if ( index < 0 ) {
@@ -57,27 +57,27 @@ String.prototype.score = function (abbreviation,offset) {
5757 continue ;
5858 }
5959
60- var next_string = this . substring ( index + sub_abbreviation . length )
61- var next_abbreviation = null
60+ var next_string = this . substring ( index + sub_abbreviation . length ) ;
61+ var next_abbreviation = null ;
6262
6363 if ( i >= abbreviation . length ) {
64- next_abbreviation = ''
64+ next_abbreviation = '' ;
6565 } else {
66- next_abbreviation = abbreviation . substring ( i )
66+ next_abbreviation = abbreviation . substring ( i ) ;
6767 }
6868
69- var remaining_score = next_string . score ( next_abbreviation , offset + index )
69+ var remaining_score = next_string . score ( next_abbreviation , offset + index ) ;
7070
7171 if ( remaining_score > 0 ) {
7272 var score = this . length - next_string . length ;
7373
7474 if ( index != 0 ) {
7575 var j = 0 ;
76- var c = this . charCodeAt ( index - 1 )
76+ var c = this . charCodeAt ( index - 1 ) ;
7777 if ( c == 32 || c == 9 ) {
7878 for ( j = ( index - 2 ) ; j >= 0 ; j -- ) {
79- c = this . charCodeAt ( j )
80- score -= ( ( c == 32 || c == 9 ) ? 1 : 0.15 )
79+ c = this . charCodeAt ( j ) ;
80+ score -= ( ( c == 32 || c == 9 ) ? 1 : 0.15 ) ;
8181 }
8282 // XXX maybe not port this heuristic
8383 //
@@ -89,14 +89,14 @@ String.prototype.score = function (abbreviation,offset) {
8989 // score -= 0.15;
9090 // }
9191 } else {
92- score -= index
92+ score -= index ;
9393 }
9494 }
9595
96- score += remaining_score * next_string . length
96+ score += remaining_score * next_string . length ;
9797 score /= this . length ;
98- return score
98+ return score ;
9999 }
100100 }
101- return 0.0
102- }
101+ return 0.0 ;
102+ } ;
0 commit comments