1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

change arg findByTag

This commit is contained in:
Sosuke Suzuki
2017-05-31 20:49:34 +09:00
parent fc4c471a87
commit 290e6ab170

View File

@@ -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