refactor: make sortTags private
This commit is contained in:
parent
eb42c87a6e
commit
13f6bbc748
1 changed files with 5 additions and 5 deletions
|
|
@ -7,12 +7,12 @@ export default class TagsService {
|
||||||
this.database = database
|
this.database = database
|
||||||
}
|
}
|
||||||
|
|
||||||
sortTags = (tags) => {
|
|
||||||
return tags.sort((a, b) => a.name.localeCompare(b.name))
|
|
||||||
}
|
|
||||||
|
|
||||||
getAllTags = () => {
|
getAllTags = () => {
|
||||||
const tags = this.sortTags(this.database.prepare(GET_ALL_TAGS).all()).flatMap((tag) => tag.name)
|
const tags = this._sortTags(this.database.prepare(GET_ALL_TAGS).all()).flatMap((tag) => tag.name)
|
||||||
return { count: tags.length, tags: tags }
|
return { count: tags.length, tags: tags }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_sortTags = (tags) => {
|
||||||
|
return tags.sort((a, b) => a.name.localeCompare(b.name))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue