1
0
mirror of https://github.com/svg/svgo.git synced 2025-07-29 20:21:14 +03:00

plugins/cleanupNumericValues: wrong floating-point numbers regexp (fix #92)

This commit is contained in:
deepsweet
2013-01-18 15:36:26 +02:00
parent 5e5cb1aecc
commit c04888df4d

View File

@ -1,6 +1,6 @@
'use strict'; 'use strict';
var regNumericValues = /^([\-+]?\d*\.?\d+(\.\d+)?([eE][\-+]?\d+)?)(px|pt|pc|mm|cm|m|in|ft|em|ex|%)?$/, var regNumericValues = /^([\-+]?\d*\.?\d+([eE][\-+]?\d+)?)(px|pt|pc|mm|cm|m|in|ft|em|ex|%)?$/,
removeLeadingZero = require('../lib/svgo/tools').removeLeadingZero; removeLeadingZero = require('../lib/svgo/tools').removeLeadingZero;
/** /**
@ -26,7 +26,7 @@ exports.cleanupNumericValues = function(item, params) {
if (match) { if (match) {
// round it to the fixed precision // round it to the fixed precision
var num = +(+match[1]).toFixed(params.floatPrecision), var num = +(+match[1]).toFixed(params.floatPrecision),
units = match[4] || ''; units = match[3] || '';
// and remove leading zero // and remove leading zero
if (params.leadingZero) { if (params.leadingZero) {