12 lines
400 B
TypeScript
12 lines
400 B
TypeScript
|
|
import { Prisma } from '@prisma/client';
|
||
|
|
|
||
|
|
/** Normalize the JSON `teeth` column of a lab case task into a clean string[]. */
|
||
|
|
export function normalizeTaskTeeth(value: Prisma.JsonValue | null | undefined): string[] {
|
||
|
|
if (!Array.isArray(value)) {
|
||
|
|
return [];
|
||
|
|
}
|
||
|
|
return value
|
||
|
|
.filter((v): v is string | number => typeof v === 'string' || typeof v === 'number')
|
||
|
|
.map((v) => String(v));
|
||
|
|
}
|