Better HN
topnewbestaskshowjobs
Log inSign up

blakeembrey

1 karma · joined Sep 12, 2013 (13y ago) · 2 submissions

Submissions

1.

ReDoS in JavaScript Routers(blakeembrey.com ↗)

1 points · by blakeembrey · 2y ago · discuss

comment 11y ago · link · parent

That's a great point! Maybe you should log an issue or make a PR and fix it for everyone (except those who copied and pasted). This is exactly why it's a good thing for smaller modules that do one thing well, because when a tiny bug pops up everyone can automatically apply the patch.

I did do some tests a around this, but it showed nothing substantial. The comparison solution is much faster overall, the only point it falls down is with all lowercase strings where an early return would obviously be faster. Even a regexp was faster in some cases. It's highly subjective.