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