Skip to content

Commit

Permalink
chore: update logic
Browse files Browse the repository at this point in the history
Co-authored-by: yoyo837 <[email protected]>
  • Loading branch information
Wxh16144 and yoyo837 committed Mar 13, 2024
1 parent e2a679b commit a79f96a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/transformers/legacyLogicalProperties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function splitValues(
.split(/\s+/);

// Combine styles split in brackets, like `calc(1px + 2px)`
let temp = '';
let temp: string[] = [];
let brackets = 0;
return [
splitStyle.reduce<string[]>((list, item) => {
Expand All @@ -25,11 +25,10 @@ function splitValues(
const right = item.split(')').length - 1;
brackets += left - right;
}
if (brackets >= 0) temp.push(item);
if (brackets === 0) {
list.push(`${temp} ${item}`);
temp = '';
} else if (brackets > 0) {
temp += ` ${item}`;
list.push(temp.join(' '));
temp = [];
}
return list;
}, []),
Expand Down

0 comments on commit a79f96a

Please sign in to comment.