Skip to content

Commit

Permalink
style: conditionally add keyword property
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Nov 8, 2021
1 parent 44df546 commit 8f6c22f
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/internalFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,10 @@ const testValue = (
const capture = (condition: boolean | string) => {
if (condition) {
if (highlights) {
if (typeof condition === 'string') {
highlights.push({
keyword: condition,
path: path.join('.'),
});
} else {
highlights.push({
path: path.join('.'),
});
}
highlights.push({
...typeof condition === 'string' && {keyword: condition},
path: path.join('.'),
});
}

return true;
Expand Down

0 comments on commit 8f6c22f

Please sign in to comment.