From 6326ef9a50185989779870426314520564ba4e2b Mon Sep 17 00:00:00 2001 From: WEBXOSS Date: Sun, 7 May 2017 16:51:30 +0800 Subject: [PATCH] fix searching with translation --- DeckEditor/Searcher.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/DeckEditor/Searcher.js b/DeckEditor/Searcher.js index 105831d..34eda1c 100644 --- a/DeckEditor/Searcher.js +++ b/DeckEditor/Searcher.js @@ -1,9 +1,5 @@ 'use strict'; function Searcher () { - this.infos = []; - for (var pid in CardInfo) { - this.infos.push(CardInfo[pid]); - } this.rules = [ ColorRule, CrossRule, @@ -30,7 +26,10 @@ Searcher.prototype.search = function (str) { var filters = this.rules.map(function (rule) { return rule.parse(words); },this); + var infos = Object.keys(CardInfo).map(function (pid) { + return CardInfo[pid]; + }); return filters.reduce(function (results,filter) { return results.filter(filter); - },this.infos); + },infos); }; \ No newline at end of file