So you want to slow your code down for the benefit of perceived readability for people who aren't so good at regex? This would be something better done at build time
Also, if you really want to do it right there in the code, you could make the syntax a lot nicer by using a tagged template:
The slowdown is negligible. If used in a service or class, the regex can be generated once.
As to people who βarenβt so good at regex,β I always write my code with the assumption that someone else has to figure out what I did and if I can make readability easier, I should. That is what the whole project is about.
Tagged template: hadnβt thought of that. Iβll look into it.
Thanks!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
So you want to slow your code down for the benefit of perceived readability for people who aren't so good at regex? This would be something better done at build time
Also, if you really want to do it right there in the code, you could make the syntax a lot nicer by using a tagged template:
Tagged Template Literal is now included.
Also, there are plans to incorporate this within build tools.
The slowdown is negligible. If used in a service or class, the regex can be generated once.
As to people who βarenβt so good at regex,β I always write my code with the assumption that someone else has to figure out what I did and if I can make readability easier, I should. That is what the whole project is about.
Tagged template: hadnβt thought of that. Iβll look into it.
Thanks!