From 290e6ab1709cc0e65bcece5858061134fcdd6cca Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Wed, 31 May 2017 20:49:34 +0900 Subject: [PATCH] change arg findByTag --- browser/lib/search.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/browser/lib/search.js b/browser/lib/search.js index 813eb667..0a9505f3 100644 --- a/browser/lib/search.js +++ b/browser/lib/search.js @@ -6,8 +6,7 @@ export default function searchFromNotes(data, search){ let searchBlocks = search.split(' ') searchBlocks.forEach((block) => { if (block.match(/^#.+/)) { - const tag = block.match(/#(.+)/)[1] - notes = findByTag(notes, tag) + notes = findByTag(notes, block) } else { notes = findByWord(notes, block) } @@ -15,7 +14,8 @@ export default function searchFromNotes(data, search){ return notes } -function findByTag(notes, tag){ +function findByTag(notes, block){ + const tag = block.match(/#(.+)/)[1] let regExp = new RegExp(_.escapeRegExp(tag), 'i') return notes.filter((note) => { if (!_.isArray(note.tags)) return false