Skip to content

Conversation

tonetheman
Copy link
Contributor

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.

lib/parsers.js Outdated
var val = m[0];

var isNegated = isOdd(val.length);
var isNegated = Math.abs(val.length%2)==1;

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 :)

Copy link
Contributor Author

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 :)

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.

Copy link
Member

@doowb doowb left a 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);
Copy link
Member

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;

@kevinji
Copy link

kevinji commented Mar 30, 2018

This looks identical to the patch in #7.

@doowb
Copy link
Member

doowb commented Mar 31, 2018

@tonetheman thanks for the PR!

/cc @jonschlinkert @phated @es128 if there are no objects, I think this can be published as a patch bump.

@doowb doowb merged commit 59b00a7 into micromatch:master Mar 31, 2018
@jonschlinkert
Copy link
Member

ftr, this is the last PR that will be accepted for is-odd or is-even. we don't have time for trolls.

@micromatch micromatch locked and limited conversation to collaborators Mar 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants