File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ const highlighters = [
29
29
} ,
30
30
{
31
31
name : 'function' ,
32
- regex : / ( \w * ?) \( / g,
32
+ regex : / ( \w + ?) \( / g,
33
33
trimEnd : 1
34
34
} ,
35
35
{
@@ -48,12 +48,14 @@ const highlighters = [
48
48
49
49
function highlight ( sqlString , options ) {
50
50
options = Object . assign ( { } , DEFAULT_OPTIONS , options )
51
-
51
+
52
52
const matches = [ ]
53
53
54
54
for ( const hl of highlighters ) {
55
55
let match
56
-
56
+
57
+ // This is probably the one time when an assignment inside a condidion makes sense
58
+ // eslint-disable-next-line no-cond-assign
57
59
while ( match = hl . regex . exec ( sqlString ) ) {
58
60
matches . push ( {
59
61
name : hl . name ,
@@ -66,7 +68,7 @@ function highlight (sqlString, options) {
66
68
const sortedMatches = matches . slice ( ) . sort ( ( a , b ) => a . start - b . start )
67
69
68
70
// filter/exclude nested matches (matches within the last match)
69
- let filteredMatches = [ ]
71
+ const filteredMatches = [ ]
70
72
let upperBound = 0
71
73
for ( let i = 0 ; i < sortedMatches . length ; i ++ ) {
72
74
if ( sortedMatches [ i ] . start >= upperBound ) {
You can’t perform that action at this time.
0 commit comments