Skip to content

Fix parsing of byte strings lacking leading 0 before decimal#63

Open
TylerAldrich wants to merge 1 commit intovisionmedia:masterfrom
TylerAldrich:regex-update
Open

Fix parsing of byte strings lacking leading 0 before decimal#63
TylerAldrich wants to merge 1 commit intovisionmedia:masterfrom
TylerAldrich:regex-update

Conversation

@TylerAldrich
Copy link

I noticed the following issue:

> bytes.parse('.25GB');
null
> bytes.parse('0.25GB');
268435456

where if a leading 0 is not supplied, null is always returned. I updated the parse regex to look for 0 or more leading digits so that '.25GB' could be parsed correctly, and added some tests to verify that omitting a leading 0 returns the same result as supplying one.

@TylerAldrich
Copy link
Author

FYI @dougwilson - It looks like when the actions were running there was an issue with downloading https://iojs.org/dist/v2.5.0/iojs-v2.5.0.tar.xz that appears to be fixed (the link itself is working for me now, was erroring 2 days ago).

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.

1 participant