Files
web/components/TempDesignSystem/utils/checkForEmptyChildren.ts
2024-06-18 16:21:43 +02:00

14 lines
312 B
TypeScript

import { Children, type ReactNode } from "react"
export function checkForEmptyChildren(children: ReactNode) {
return Children.toArray(children).filter((child) => {
if (child === "") {
return false
} else if (child == null) {
return false
} else {
return true
}
}).length
}