Skip to content

Commit

Permalink
fix: remove explicit return type from getKeyword (#11)
Browse files Browse the repository at this point in the history
* fix: remove explicit return type

* fix: return empty array if keyword is not defined
  • Loading branch information
jaulz authored Jun 26, 2020
1 parent e86db00 commit 1b20be6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,13 @@ export class AdvancedSearchQuery {
}, {})
}

getKeyword(name: string): Omit<Keyword, 'name'>[] {
return this.getKeywords()[name]
getKeyword(name: string) {
const keyword = this.getKeywords()[name]
if (!keyword) {
return []
}

return keyword
}

toObject() {
Expand Down

0 comments on commit 1b20be6

Please sign in to comment.