Mercurial > hip
comparison nounClasses.js @ 15:21bb73c5d9e1
Tiny fix to make nouns never match the empty string, so you don't get that weird thing where your input is empty and it's suggesting a list of cities.
author | jonathandicarlo@jonathan-dicarlos-macbook-pro.local |
---|---|
date | Mon, 07 Jul 2008 13:00:19 -0700 |
parents | 8dcc88f93829 |
children | 5fce4c8f3ebd |
comparison
equal
deleted
inserted
replaced
14:a26372118854 | 15:21bb73c5d9e1 |
---|---|
16 return false; | 16 return false; |
17 }, | 17 }, |
18 | 18 |
19 suggest: function( fragment ) { | 19 suggest: function( fragment ) { |
20 // returns (ordered) array of suggestions | 20 // returns (ordered) array of suggestions |
21 if (!fragment) { | |
22 return []; | |
23 } | |
21 var suggestions = []; | 24 var suggestions = []; |
22 for ( var x in this._expectedWords ) { | 25 for ( var x in this._expectedWords ) { |
23 word = this._expectedWords[x]; | 26 word = this._expectedWords[x]; |
24 if ( word.indexOf( fragment ) > -1 ) { | 27 if ( word.indexOf( fragment ) > -1 ) { |
25 suggestions.push( word ); | 28 suggestions.push( word ); |