3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-07-07 02:57:20 +00:00
zeppelin/backend/src/data/buildEntity.ts
2023-05-08 22:58:51 +03:00

7 lines
228 B
TypeScript

export function buildEntity<T extends object>(Entity: new () => T, data: Partial<T>): T {
const instance = new Entity();
for (const [key, value] of Object.entries(data)) {
instance[key] = value;
}
return instance;
}