Skip to content

Commit 84f63c6

Browse files
committed
add float support
1 parent a2bdc84 commit 84f63c6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Parser.prototype.int = function(){
3939
};
4040

4141
Parser.prototype.float = function(){
42-
var m = /^((\d+)?(\.\d+)(\S+)?) */.exec(this.str);
42+
var m = /^(((?:\d+)?\.\d+)(\S+)?) */.exec(this.str);
4343
if (!m) return;
4444
this.skip(m);
4545
var n = parseFloat(m[2]);

test/cases/numbers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ exports.object = [
77
{ type: 'number', string: '0', unit: '', value: 0 },
88
{ type: 'number', string: '5%', unit: '%', value: 5 },
99
{ type: 'number', string: '.5px', unit: 'px', value: .5 },
10-
{ type: 'number', string: '.1', unit: '', value: .1 },
10+
{ type: 'number', string: '.10', unit: '', value: .1 },
1111
{ type: 'number', string: '1.5', unit: '', value: 1.5 }
1212
];

0 commit comments

Comments
 (0)