PronounsPage/shared/utils/getWithKey.ts
Valentyne Stigloher 10180aa6a3 (refactor) use #shared alias instead of ~~/shared
the #shared alias used by Nuxt cannot be easily disabled and to prevent breackage with jiti, we make use of it
2025-08-17 18:56:02 +02:00

9 lines
309 B
TypeScript

import type { WithKey } from '#shared/utils/entriesWithKeys.ts';
export default <T>(record: Record<string, T> | undefined, key: string | undefined): WithKey<T> | undefined => {
if (key === undefined || record?.[key] === undefined) {
return undefined;
}
return { ...record[key], key };
};