@@ -207,7 +207,7 @@ var freeze = function() {
207207
208208var matchStringToFilterChain = function ( filter , s , tokenBeg ) {
209209 var filterBeg ;
210- while ( filter ) {
210+ while ( filter !== undefined ) {
211211 // rhill 2014-03-05: Benchmarking shows that's the fastest way to do this.
212212 filterBeg = tokenBeg - filter . tokenBeg ;
213213 if ( s . indexOf ( filter . s , filterBeg ) === filterBeg ) {
@@ -236,28 +236,28 @@ var matchString = function(s) {
236236 prefixKey = tokenBeg > 0 ? s . charAt ( matches . index - 1 ) : '' ;
237237 suffixKey = s . substr ( tokenEnd , 2 ) ;
238238
239- if ( prefixKey && suffixKey . length > 1 ) {
240- if ( matchFn ( fidx [ prefixKey + token + suffixKey ] , s , tokenBeg ) ) {
241- return true ;
239+ if ( suffixKey . length > 1 ) {
240+ if ( prefixKey !== '' ) {
241+ if ( matchFn ( fidx [ prefixKey + token + suffixKey ] , s , tokenBeg ) ) {
242+ return true ;
243+ }
242244 }
243- }
244- if ( prefixKey && suffixKey ) {
245- if ( matchFn ( fidx [ prefixKey + token + suffixKey . charAt ( 0 ) ] , s , tokenBeg ) ) {
245+ if ( matchFn ( fidx [ token + suffixKey ] , s , tokenBeg ) ) {
246246 return true ;
247247 }
248248 }
249- if ( prefixKey ) {
250- if ( matchFn ( fidx [ prefixKey + token ] , s , tokenBeg ) ) {
251- return true ;
249+ if ( suffixKey !== '' ) {
250+ if ( prefixKey !== '' ) {
251+ if ( matchFn ( fidx [ prefixKey + token + suffixKey . charAt ( 0 ) ] , s , tokenBeg ) ) {
252+ return true ;
253+ }
252254 }
253- }
254- if ( suffixKey . length > 1 ) {
255- if ( matchFn ( fidx [ token + suffixKey ] , s , tokenBeg ) ) {
255+ if ( matchFn ( fidx [ token + suffixKey . charAt ( 0 ) ] , s , tokenBeg ) ) {
256256 return true ;
257257 }
258258 }
259- if ( suffixKey ) {
260- if ( matchFn ( fidx [ token + suffixKey . charAt ( 0 ) ] , s , tokenBeg ) ) {
259+ if ( prefixKey !== '' ) {
260+ if ( matchFn ( fidx [ prefixKey + token ] , s , tokenBeg ) ) {
261261 return true ;
262262 }
263263 }
0 commit comments