Skip to content

Commit

Permalink
refactor(cleanupNumbericValues): improve how viewbox is split
Browse files Browse the repository at this point in the history
Co-authored-by: GreLI <grelimail@gmail.com>
  • Loading branch information
SethFalco and GreLI committed Jul 2, 2024
1 parent a59f47b commit 534a54f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions plugins/cleanupNumericValues.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ export const fn = (_root, params) => {
element: {
enter: (node) => {
if (node.attributes.viewBox != null) {
const nums = node.attributes.viewBox.split(/\s,?\s*|,\s*/g);
const nums = node.attributes.viewBox.trim().split(/(?:\s,?|,)\s*/g);
node.attributes.viewBox = nums
.filter((value) => value.length != 0)
.map((value) => {
const num = Number(value);
return Number.isNaN(num)
Expand Down

0 comments on commit 534a54f

Please sign in to comment.