Skip to content

Commit

Permalink
Speed up stringifyNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinhagemeister committed Nov 27, 2022
1 parent ae32acf commit 2e689ae
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/path.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

const { removeLeadingZero } = require('./svgo/tools');

/**
* @typedef {import('./types').PathDataItem} PathDataItem
* @typedef {import('./types').PathDataCommand} PathDataCommand
Expand Down Expand Up @@ -249,7 +251,7 @@ const stringifyNumber = (number, precision) => {
number = Math.round(number * ratio) / ratio;
}
// remove zero whole from decimal number
return number.toString().replace(/^0\./, '.').replace(/^-0\./, '-.');
return removeLeadingZero(number);
};

/**
Expand Down

0 comments on commit 2e689ae

Please sign in to comment.