summaryrefslogtreecommitdiff
path: root/node_modules/svgo/lib/path.js
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2023-12-21 22:46:53 +0800
committerlittleblack111 <littleblack11111@gmail.com>2023-12-21 22:46:53 +0800
commitf06956efd2dc4bf77244a9fcce2b883a00b925af (patch)
tree0123cb73ce67f1f4b17e1d6cbabff076ee44e31b /node_modules/svgo/lib/path.js
parent8d980c13970c15b6d2312b6fc4ac51698dd0d220 (diff)
updated node modules
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);
};
/**