From bf0a3d9d1496f711cfe314aeb1a4191594e60e92 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Tue, 11 Feb 2020 22:06:56 -0800 Subject: [PATCH] search_suggestion: Convert prev from object to Set. Signed-off-by: Anders Kaseorg --- static/js/search_suggestion.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/static/js/search_suggestion.js b/static/js/search_suggestion.js index 4da2c66d95..f31bb3fec6 100644 --- a/static/js/search_suggestion.js +++ b/static/js/search_suggestion.js @@ -582,7 +582,7 @@ function get_operator_suggestions(last) { function make_attacher(base) { const self = {}; self.result = []; - const prev = {}; + const prev = new Set(); function prepend_base(suggestion) { if (base && base.description.length > 0) { @@ -592,8 +592,8 @@ function make_attacher(base) { } self.push = function (suggestion) { - if (!prev[suggestion.search_string]) { - prev[suggestion.search_string] = suggestion; + if (!prev.has(suggestion.search_string)) { + prev.add(suggestion.search_string); self.result.push(suggestion); } };