Skip to content

Commit

Permalink
refactor(cleanupNumbericValues): improve how viewbox is split (#2046)
Browse files Browse the repository at this point in the history
  • Loading branch information
SethFalco authored Jul 2, 2024
1 parent a59f47b commit 9078e8c
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 9078e8c

Please sign in to comment.