Calling .match() twice does double the work, which may be significant when this runs millions of times.
Also, you cannot rewrite a === b?.c to a === b && b.c. Operator precedence means that this is equivalent to (a === b) && b.c, which is not the same. You need to enforce grouping with parens.
Since time is of the essence, I just pushed a fix for both and I'm gonna go ahead and close this.
Thanks!
Calling
.match()
twice does double the work, which may be significant when this runs millions of times.Also, you cannot rewrite
a === b?.c
toa === b && b.c
. Operator precedence means that this is equivalent to(a === b) && b.c
, which is not the same. You need to enforce grouping with parens.Since time is of the essence, I just pushed a fix for both and I'm gonna go ahead and close this.