Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
simplify loops to cover all cases
  • Loading branch information
RobinMalfait committed Apr 7, 2025
commit 6d7dc9bdb6d416f3acb9ccd2d5a32fa3e147940e
17 changes: 7 additions & 10 deletions packages/tailwindcss/src/utils/brace-expansion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,13 @@ function expandSequence(seq: string): string[] {
if (step === 0) {
throw new Error('Step cannot be zero in sequence expansion.')
}
if (step > 0) {
for (let i = startNum; i <= endNum; i += step) {
let numStr = i.toString()
result.push(numStr)
}
} else {
for (let i = startNum; i >= endNum; i += step) {
let numStr = i.toString()
result.push(numStr)
}

let increasing = startNum < endNum
if (increasing && step < 0) step = -step
if (!increasing && step > 0) step = -step

for (let i = startNum; increasing ? i <= endNum : i >= endNum; i += step) {
result.push(i.toString())
}
}
return result
Expand Down