Skip to content

Commit

Permalink
Remove while loops when clearing limit offset
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcetinkaya committed Mar 27, 2021
1 parent ac901f6 commit 3feaf47
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/vanilla/components/limit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ export function Limit(min: number, max: number): LimitType {
}

function removeOffset(n: number): number {
if (min === max) return n
while (reachedMin(n)) n += length
while (reachedMax(n)) n -= length
return n
if (!length) return n
return n - length * Math.ceil((n - max) / length)
}

function loop(n: number): number {
Expand Down

0 comments on commit 3feaf47

Please sign in to comment.