From db5ad5223a4a51e0edb630083230ce406a541aca Mon Sep 17 00:00:00 2001 From: Aaron Lidman Date: Fri, 22 Nov 2013 12:58:49 -0800 Subject: [PATCH] Put searchable and suggestions back in MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tests were not happy and I’m not going to dive into it right now. Benchmarked it and it’s pretty quick, no big deal. --- js/id/presets/collection.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/js/id/presets/collection.js b/js/id/presets/collection.js index df6888172..6492fde7f 100644 --- a/js/id/presets/collection.js +++ b/js/id/presets/collection.js @@ -1,13 +1,7 @@ iD.presets.Collection = function(collection) { var maxSearchResults = 50, - maxSuggestionResults = 10, - searchable = _.filter(collection, function(a) { - return a.searchable !== false && a.suggestion !== true; - }), - suggestions = _.filter(collection, function(a) { - return a.suggestion === true; - }); + maxSuggestionResults = 10; var presets = { @@ -30,6 +24,13 @@ iD.presets.Collection = function(collection) { value = value.toLowerCase(); + var searchable = _.filter(collection, function(a) { + return a.searchable !== false && a.suggestion !== true; + }), + suggestions = _.filter(collection, function(a) { + return a.suggestion === true; + }); + // matches value to preset.name var leading_name = _.filter(searchable, function(a) { return leading(a.name().toLowerCase());