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:
@ -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) {
|
||||||
|
Reference in New Issue
Block a user