Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ describe('unicode', () => {
.toBe('[keyword]select[clear]')
})

it('keywords (mixed case)', () => {
expect(hlUni('SElect'))
.toBe('[keyword]SElect[clear]')
})

it('special characters', () => {
expect(hlUni('='))
.toBe('[special]=[clear]')
Expand Down
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const highlighters = [
{
name: 'keyword',
group: 1,
regex: new RegExp(`(^|${SPLIT_CHARS})(${keywords.join('|')})(?=${SPLIT_CHARS}|$)`, 'g')
regex: new RegExp(`(^|${SPLIT_CHARS})(${keywords.join('|')})(?=${SPLIT_CHARS}|$)`, 'gi')
},
{
name: 'special',
Expand Down
7 changes: 1 addition & 6 deletions lib/keywords.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const KEYWORDS = [
module.exports = [
'ADD',
'ADD CONSTRAINT',
'ALTER',
Expand Down Expand Up @@ -140,8 +140,3 @@ const KEYWORDS = [
'PRINT',
'OVERLAPS'
]

module.exports = [
...KEYWORDS,
...KEYWORDS.map((keyword) => keyword.toLowerCase())
]