summaryrefslogtreecommitdiff
path: root/node_modules/svgo/lib/path.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/svgo/lib/path.js')
-rw-r--r--node_modules/svgo/lib/path.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/node_modules/svgo/lib/path.js b/node_modules/svgo/lib/path.js
index 5a68e8fd..1e383dd9 100644
--- a/node_modules/svgo/lib/path.js
+++ b/node_modules/svgo/lib/path.js
@@ -1,5 +1,7 @@
'use strict';
+const { removeLeadingZero } = require('./svgo/tools');
+
/**
* @typedef {import('./types').PathDataItem} PathDataItem
* @typedef {import('./types').PathDataCommand} PathDataCommand
@@ -66,7 +68,7 @@ const isDigit = (c) => {
*/
/**
- * @type {(string: string, cursor: number) => [number, number | null]}
+ * @type {(string: string, cursor: number) => [number, ?number]}
*/
const readNumber = (string, cursor) => {
let i = cursor;
@@ -141,7 +143,7 @@ const parsePathData = (string) => {
*/
const pathData = [];
/**
- * @type {null | PathDataCommand}
+ * @type {?PathDataCommand}
*/
let command = null;
let args = /** @type {number[]} */ ([]);
@@ -226,7 +228,7 @@ const parsePathData = (string) => {
// flush arguments when necessary count is reached
if (args.length === argsCount) {
pathData.push({ command, args });
- // subsequent moveto coordinates are threated as implicit lineto commands
+ // subsequent moveto coordinates are treated as implicit lineto commands
if (command === 'M') {
command = 'L';
}
@@ -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);
};
/**