cal.pub0.org/apps/web/lib/isPrismaObj.ts

12 lines
301 B
TypeScript

import type { Prisma } from "@prisma/client";
function isPrismaObj(obj: unknown): obj is Prisma.JsonObject {
return typeof obj === "object" && !Array.isArray(obj);
}
export function isPrismaObjOrUndefined(obj: unknown) {
return isPrismaObj(obj) ? obj : undefined;
}
export default isPrismaObj;