-
-
Notifications
You must be signed in to change notification settings - Fork 20
Remove isodd #11
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
Remove isodd #11
Conversation
lib/parsers.js
Outdated
| var val = m[0]; | ||
|
|
||
| var isNegated = isOdd(val.length); | ||
| var isNegated = Math.abs(val.length%2)==1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is great, but I doubt you need to worry about strings with negative length :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah just being careful. I can take out the Math.abs if you want :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like being careful is how we got to isOdd in the first place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! There are a couple of syntax changes, then I think it looks good to merge.
lib/parsers.js
Outdated
| var val = m[0]; | ||
|
|
||
| var isNegated = isOdd(val.length); | ||
| var isNegated = ((val.length%2)==1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicks:
- remove the outer parentheses
- put spaces before and after the
%and the== - use strict equal
===
Basically: var isNegated = (val.length % 2) === 1;
|
This looks identical to the patch in #7. |
|
@tonetheman thanks for the PR! /cc @jonschlinkert @phated @es128 if there are no objects, I think this can be published as a patch bump. |
|
ftr, this is the last PR that will be accepted for is-odd or is-even. we don't have time for trolls. |
I removed is-odd from your dependencies. It looked like you used an npm package called is-odd.
It felt like you might not need a package to do that small of a test. No worries if you choose not to take the PR.
After my change I checked that all tests still passed. I did not add any new tests since the change looked like it would be tested during the negate portion of your existing tests.