diff options
author | Sebastian <sebasjm@gmail.com> | 2022-11-04 11:18:30 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-11-04 11:56:05 -0300 |
commit | a69e559890d888d10739c8e29549ff37b788743a (patch) | |
tree | 87c0c3976f64ece357e2de2b9727c07ee87dcf78 /packages/merchant-backoffice-ui/src/components | |
parent | 80ab8ccce9a9ce46b445d0857769aadd640073a3 (diff) | |
download | wallet-core-a69e559890d888d10739c8e29549ff37b788743a.tar.xz |
better type signature for undefinedIfEmpty
Diffstat (limited to 'packages/merchant-backoffice-ui/src/components')
-rw-r--r-- | packages/merchant-backoffice-ui/src/components/form/InputPaytoForm.tsx | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/packages/merchant-backoffice-ui/src/components/form/InputPaytoForm.tsx b/packages/merchant-backoffice-ui/src/components/form/InputPaytoForm.tsx index c2aa9c3e9..e8022ca15 100644 --- a/packages/merchant-backoffice-ui/src/components/form/InputPaytoForm.tsx +++ b/packages/merchant-backoffice-ui/src/components/form/InputPaytoForm.tsx @@ -22,6 +22,7 @@ import { h, VNode, Fragment } from "preact"; import { useCallback, useState } from "preact/hooks"; import { Translate, Translator, useTranslator } from "../../i18n/index.js"; import { COUNTRY_TABLE } from "../../utils/constants.js"; +import { undefinedIfEmpty } from "../../utils/table.js"; import { FormErrors, FormProvider } from "./FormProvider.js"; import { Input } from "./Input.js"; import { InputGroup } from "./InputGroup.js"; @@ -154,12 +155,6 @@ const targets = [ const noTargetValue = targets[0]; const defaultTarget = { target: noTargetValue, options: {} }; -function undefinedIfEmpty<T>(obj: T): T | undefined { - return Object.keys(obj).some((k) => (obj as any)[k] !== undefined) - ? obj - : undefined; -} - export function InputPaytoForm<T>({ name, readonly, |