UNPKG

@keycloakify/keycloak-admin-ui

Version:

<p align="center"> <img src="https://github.com/user-attachments/assets/a6aaebbd-8f59-474d-9827-c282f4527aca"> </p> <p align="center"> <i>Repackaged Keycloak Admin UI</i> <br> <br> <a href="https://github.com/keycloakify/keycloak-adm

31 lines (22 loc) 780 B
/* eslint-disable */ // @ts-nocheck import { Path, PathValue } from "react-hook-form"; export type KeyValueType = { key: string; value: string }; export function keyValueToArray(attributeArray: KeyValueType[] = []) { const validAttributes = attributeArray.filter(({ key }) => key !== ""); const result: Record<string, string[]> = {}; for (const { key, value } of validAttributes) { if (key in result) { result[key].push(value); } else { result[key] = [value]; } } return result; } export function arrayToKeyValue<T>(attributes: Record<string, string[]> = {}) { const result = Object.entries(attributes).flatMap(([key, value]) => value.map<KeyValueType>((value) => ({ key, value })), ); return result as PathValue<T, Path<T>>; }