Skip to content

Commit

Permalink
Refactor helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
buberdds committed Oct 22, 2024
1 parent e07e543 commit 23e4be8
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/app/components/UptimeStatus/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,7 @@ const StyledBox = styled(Box)<UptimeItem>(({ small, value }) => ({
}))

export const ensureTwelveElements = (inputArray: number[] = []) => {
const truncatedArray = inputArray.slice(0, 12)
const undefinedCount = 12 - truncatedArray.length

if (undefinedCount > 0) {
const undefinedArray = new Array(undefinedCount).fill(undefined)
return truncatedArray.concat(undefinedArray)
}
return truncatedArray
return [...inputArray, ...new Array(12).fill(undefined)].slice(0, 12)
}

type UptimeStatusProps = {
Expand Down

0 comments on commit 23e4be8

Please sign in to comment.