-
-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(web): TransformUtils.insertWhitespace seems convoluted #7232
Comments
JH wrote:
|
Well... we ended up going ahead and addressing it ahead of time anyway. Took a few iterations to settle on the solution, though. |
Can you link the PR that addressed this? |
Addressed by #7241. |
This seems a little convoluted.
I'm really not sure exactly what we are testing here. It seems like you are looking for
insert.match(/[\u0009...]$/)
? Is it intended to match having a single whitespace character on the end of the text? If so, then the function name is not very clear. If not, then AFAICT the function is not correct.i
modifier should not be necessary on the regex -- there's no case to be insensitive about 🤣.Can we use a character class for the regex match rather than a set of characters? (e.g.
insert.match(/[\p{Z}\r\n]$/u)
. Note Chrome 50+ though (so we could have the shorter regex as a comment if we can't use it for back-compat reasons).Finally, can we have a javadoc comment rather than the in-function comment?
Originally posted by @mcdurdin in #7205 (comment)
The text was updated successfully, but these errors were encountered: