I’m a big fan of closeness in code. I prefer defining things as closely to where it’s used as possible. This is a big pet peeve for me!

Do not put regex at the top of the file either! Put it where you use it. Languages are smart, they’ll probably be able to tell that it’s constant anyway.

Also for tiny functions just use a lambda. Please don’t make a one line function a million miles away that you use once or twice.

Amen! The existence of 'helpers.js', 'utils.cc', makes me twitch.

[deleted]

If multiple things use the same regex, which one should it be close to? Or do you propose duplicating it?