triggerType util

This commit is contained in:
Shams mosowi
2020-10-08 13:34:54 +11:00
parent 81b8f96324
commit 3f59e2140a

View File

@@ -32,3 +32,10 @@ export async function asyncForEach(array: any[], callback: Function) {
await callback(array[index], index, array);
}
}
export const identifyTriggerType = (beforeData, afterData) =>
Boolean(beforeData) && Boolean(afterData)
? "update"
: Boolean(afterData)
? "create"
: "delete";