WIP stripe customer metedada sync (#3153)

This commit is contained in:
alannnc authored and GitHub committed 2022-07-07 15:24:42 -06:00
1 parent a7212660a4
commit 2c30976e99
3 files changed
+41 -1

No files matched your search

+9
View File
@@ -0,0 +1,9 @@
import isPrismaObj from "./isPrismaObj";
const hasKeyInMetadata = <T extends string>(
x: { metadata: unknown } | null,
key: T
): x is { metadata: { [key in T]: string | boolean | number } } =>
isPrismaObj(x?.metadata) && !!x?.metadata && key in x.metadata;
export default hasKeyInMetadata;
+11
View File
@@ -0,0 +1,11 @@
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;