moved cleanupundefined

moved tags
This commit is contained in:
ari committed 2022-07-27 19:34:45 -04:00
1 parent 27314be9a8
commit 5d9c04072b
6 files changed
+51 -35

No files matched your search

@@ -3,6 +3,7 @@ import { HAEntitiesState } from "haService/HAEntities";
import { FC } from "react";
import { AutomationAction } from "types/automations/actions";
import { AutomationCondition } from "types/automations/conditions";
import { cleanUpUndefined } from "utils/helpers";
export type OptionManager<T> = {
defaultState(): T;
isReady(s: T): boolean;
@@ -24,16 +25,6 @@ export type OptionManager<T> = {
}
);
export const cleanUpUndefined = (data: Record<string, any>): any => {
const clean: any = {};
Object.keys(data).forEach((k) => {
if (data[k] !== undefined && data[k] !== null) {
clean[k] = data[k];
}
});
return clean;
};
export const updateConditionData =
<T extends AutomationCondition>(setState: (s: T) => void) =>
(state: T, data: Partial<T>) =>