mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
change arg findByTag
This commit is contained in:
@@ -6,8 +6,7 @@ export default function searchFromNotes(data, search){
|
|||||||
let searchBlocks = search.split(' ')
|
let searchBlocks = search.split(' ')
|
||||||
searchBlocks.forEach((block) => {
|
searchBlocks.forEach((block) => {
|
||||||
if (block.match(/^#.+/)) {
|
if (block.match(/^#.+/)) {
|
||||||
const tag = block.match(/#(.+)/)[1]
|
notes = findByTag(notes, block)
|
||||||
notes = findByTag(notes, tag)
|
|
||||||
} else {
|
} else {
|
||||||
notes = findByWord(notes, block)
|
notes = findByWord(notes, block)
|
||||||
}
|
}
|
||||||
@@ -15,7 +14,8 @@ export default function searchFromNotes(data, search){
|
|||||||
return notes
|
return notes
|
||||||
}
|
}
|
||||||
|
|
||||||
function findByTag(notes, tag){
|
function findByTag(notes, block){
|
||||||
|
const tag = block.match(/#(.+)/)[1]
|
||||||
let regExp = new RegExp(_.escapeRegExp(tag), 'i')
|
let regExp = new RegExp(_.escapeRegExp(tag), 'i')
|
||||||
return notes.filter((note) => {
|
return notes.filter((note) => {
|
||||||
if (!_.isArray(note.tags)) return false
|
if (!_.isArray(note.tags)) return false
|
||||||
|
|||||||
Reference in New Issue
Block a user