mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-08-03 11:07:00 -04:00
9 lines
295 B
TypeScript
9 lines
295 B
TypeScript
import type { WithKey } from '~/utils/withKey.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 };
|
|
};
|