3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-18 15:00:00 +00:00
zeppelin/backend/src/data/buildEntity.ts

7 lines
225 B
TypeScript

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