Skip to content

Commit 2e689ae

Browse files
Speed up stringifyNumber
1 parent ae32acf commit 2e689ae

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/path.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict';
22

3+
const { removeLeadingZero } = require('./svgo/tools');
4+
35
/**
46
* @typedef {import('./types').PathDataItem} PathDataItem
57
* @typedef {import('./types').PathDataCommand} PathDataCommand
@@ -249,7 +251,7 @@ const stringifyNumber = (number, precision) => {
249251
number = Math.round(number * ratio) / ratio;
250252
}
251253
// remove zero whole from decimal number
252-
return number.toString().replace(/^0\./, '.').replace(/^-0\./, '-.');
254+
return removeLeadingZero(number);
253255
};
254256

255257
/**

0 commit comments

Comments
 (0)