export function CASE<T>(...args: [boolean, T][]) {
return args.find(a => a[0])?.[1]
}
Example:
CASE(
[
status.type === StatusType.ERROR,
h(AppError, { message: status.message })
],
[status.type === StatusType.INIT, h(AppInit)],
[
true,
div('.branding-below', [
div('.prop.header', [
div('.name', span('Наименование')),
div('.value', span('Значение'))
]),
div(
properties.filter(p => p.value !== null).map(p => h(Property, p))
),
div(h(Draft, draft))
])
]
)