Skip to content

Commit 80288e5

Browse files
committed
Replacing map with for loop
1 parent 216f05d commit 80288e5

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

packages/motion-dom/src/animation/GroupAnimation.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,13 @@ function getMax(
116116
animations: GroupedAnimations,
117117
propName: "iterationDuration" | "duration"
118118
): number {
119-
return (
120-
Math.max(
121-
...animations
122-
.map((animation) => animation[propName])
123-
.filter((value) => value !== null)
124-
) || 0
125-
)
119+
let max = 0
120+
121+
for (let i = 0; i < animations.length; i++) {
122+
const value = animations[i][propName]
123+
if (value !== null && value > max) {
124+
max = value
125+
}
126+
}
127+
return max
126128
}

0 commit comments

Comments
 (0)