-
Notifications
You must be signed in to change notification settings - Fork 20.5k
Fix #12959: Optimize library-wide patterns #1046
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
Conversation
|
@jquerybot retest |
|
FMOI, What are the patterns and why do they end up being better? |
|
It'd be good to get these into our style guide so that everyone knows to follow them in the future. For example, should we always be doing for loops in the form |
|
The style guide actually explicitly states:
...despite it being used twice in |
|
|
|
The pattern being matched is just |
|
I like the fact you don't need to trim when using match. |
Other than that, there was just a little bit of cruft to cleanup. |
|
The changes look good to me in general, the -142 seems magical. Glad you found regexdash, it seems like jshint has an option for every occasion and that one was annoying. I'm not a big fan of initializing a loop variable far away from where it's being used, but the "far away" part is more due to some of the huge complex methods we have. @mikesherov has been threatening to turn on some of the complexity metrics. |
|
I asked John why that was in the styleguide and he said the point was originally the difference in null.match(...); // => error/\s/.exec( null ); // => `null`However, as Dave pointed out, there is one thing you can't duplicate with |
|
maxcomplexity ftw On Mon, Nov 26, 2012 at 9:40 AM, Timmy Willison [email protected]:
Mike Sherov |
|
For the record, our other common numeric iterations look like:
And on node iterations:
With lots of deviations from all of the above all over the place. To be honest, I think there's a lot more savings to be had from reducing the amount of variation here. |
…empty()). Signed-off-by: Rick Waldron <[email protected]>
Sizes - compared to master @ 53a0666