1
1
/**
2
- * LiquidMetal, version: 1.2 (2012-03-28 )
2
+ * LiquidMetal, version: 1.2.1 (2012-04-21 )
3
3
*
4
4
* A mimetic poly-alloy of Quicksilver's scoring algorithm, essentially
5
5
* LiquidMetal.
@@ -18,7 +18,7 @@ var LiquidMetal = (function() {
18
18
var SCORE_TRAILING = 0.8 ;
19
19
var SCORE_TRAILING_BUT_STARTED = 0.9 ;
20
20
var SCORE_BUFFER = 0.85 ;
21
- var WORD_SEPARATORS = [ " " , "\t" , "_" , "-" ] ;
21
+ var WORD_SEPARATORS = " \t_-" ;
22
22
23
23
return {
24
24
lastScore : null ,
@@ -36,7 +36,7 @@ var LiquidMetal = (function() {
36
36
this . _scoreAll ( string , search , abbrev , - 1 , 0 , [ ] , allScores ) ;
37
37
38
38
// complete miss
39
- if ( ! allScores . length ) return 0 ;
39
+ if ( allScores . length == 0 ) return 0 ;
40
40
41
41
// sum per-character scores into overall scores,
42
42
// selecting the maximum score
@@ -65,7 +65,7 @@ var LiquidMetal = (function() {
65
65
// save completed match scores at end of search
66
66
if ( abbrIndex == abbrev . length ) {
67
67
// add trailing score for the remainder of the match
68
- var started = ( search [ 0 ] == abbrev [ 0 ] ) ;
68
+ var started = ( search . charAt ( 0 ) == abbrev . charAt ( 0 ) ) ;
69
69
var trailScore = started ? SCORE_TRAILING_BUT_STARTED : SCORE_TRAILING ;
70
70
fillArray ( scores , trailScore , scores . length , string . length ) ;
71
71
// save score clone (since reference is persisted in scores)
@@ -74,7 +74,7 @@ var LiquidMetal = (function() {
74
74
}
75
75
76
76
// consume current char to match
77
- var c = abbrev [ abbrIndex ] ;
77
+ var c = abbrev . charAt ( abbrIndex ) ;
78
78
abbrIndex ++ ;
79
79
80
80
// cancel match if a character is missing
0 commit comments