From ee94bda2958e25818d55c895e2e46b4534d36423 Mon Sep 17 00:00:00 2001 From: Sergey Krylov Date: Sun, 8 Feb 2026 10:04:14 +0300 Subject: [PATCH] feat: add util --- src/lib/index.ts | 2 +- src/lib/utils/convert-enum.util.ts | 3 +++ src/lib/utils/index.ts | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 src/lib/utils/convert-enum.util.ts create mode 100644 src/lib/utils/index.ts diff --git a/src/lib/index.ts b/src/lib/index.ts index 6b6cf22..79ac5f1 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -1,2 +1,2 @@ - +export * from './utils' export * from './enums' diff --git a/src/lib/utils/convert-enum.util.ts b/src/lib/utils/convert-enum.util.ts new file mode 100644 index 0000000..68813bc --- /dev/null +++ b/src/lib/utils/convert-enum.util.ts @@ -0,0 +1,3 @@ +export function convertEnum(target: T, value: string): T[keyof T] { + return (target as any)[value] +} diff --git a/src/lib/utils/index.ts b/src/lib/utils/index.ts new file mode 100644 index 0000000..4fb76d0 --- /dev/null +++ b/src/lib/utils/index.ts @@ -0,0 +1 @@ +export * from './convert-enum.util'