Skip to content

fix(string-utils): detect [0,1] ranged values as numbers#388

Merged
bcoe merged 5 commits intoyargs:masterfrom
antongolub-forks:fix-str-utils-like-number
Jun 20, 2021
Merged

fix(string-utils): detect [0,1] ranged values as numbers#388
bcoe merged 5 commits intoyargs:masterfrom
antongolub-forks:fix-str-utils-like-number

Conversation

@antongolub
Copy link
Contributor

@antongolub antongolub commented May 29, 2021

closes #389

This PR brings back detection regular decimal fractional numbers (0.1, 0.0313) as numbers.

before:

imagemin-cli %  ./cli.js --plugin.pngquant.quality={0.1,1} --plugin.foo.bar=0.2 foo.png
{
  pngquant: { quality: [ '0.1', 1 ] },
  foo: { bar: '0.2' }
}

after:

imagemin-cli %  ./cli.js --plugin.pngquant.quality={0.1,1} --plugin.foo.bar=0.2 foo
{
  pngquant: { quality: [ 0.1, 1 ] },
  foo: { bar: 0.2 }
}

@antongolub antongolub changed the title fix(string-utils): detect 0.1 as a number like fix(string-utils): detect [0,1] ranged values as numbers May 30, 2021
@antongolub antongolub force-pushed the fix-str-utils-like-number branch from 453604b to 81b8707 Compare June 4, 2021 06:46
@antongolub
Copy link
Contributor Author

@bcoe, could you take a look?

Copy link
Member

@bcoe bcoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, but I would like to test against yargs' suite.

@bcoe
Copy link
Member

bcoe commented Jun 20, 2021

@antongolub thank you for the contribution, works great with yargs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: numeric values in [0, 1] range are not detected as numbers

2 participants