Unify 'svgpath' calls in linter (#4427)

This commit is contained in:
Álvaro Mondéjar 2020-12-22 15:39:08 +01:00 committed by GitHub
parent c1d45b60cc
commit 80594c4045
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,6 @@ const fs = require('fs');
const data = require("./_data/simple-icons.json");
const { htmlFriendlyToTitle } = require("./scripts/utils.js");
const svgPath = require("svgpath");
const parsePath = require("svgpath/lib/path_parse");
const { svgPathBbox } = require("svg-path-bbox");
const titleRegexp = /(.+) icon$/;
@ -146,7 +145,7 @@ module.exports = {
return;
}
const { segments } = parsePath(iconPath);
const { segments } = svgPath(iconPath);
const segmentParts = segments.flat().filter((num) => (typeof num === 'number'));
const countDecimals = (num) => {
@ -178,8 +177,9 @@ module.exports = {
return;
}
const { segments } = parsePath(iconPath);
const { segments: absSegments } = svgPath(iconPath).abs().unshort();
const parsedPath = svgPath(iconPath);
const { segments } = parsedPath;
const { segments: absSegments } = parsedPath.abs().unshort();
const lowerMovementCommands = ['m', 'l'];
const lowerDirectionCommands = ['h', 'v'];