modelling/lib/interfaces/Assignable.ts
2020-05-04 20:04:38 +02:00

22 lines
460 B
TypeScript

export abstract class Assignable {
protected data: Record<string, unknown> = {};
public assign (da: Assignable): void {
this.assign_object (da.get_data ());
}
public assign_to (da: Assignable): void {
da.assign (this);
}
public assign_object (obj: Record<string, unknown>): void {
for (const key of Object.keys (obj))
this.data[key] = obj[key];
}
public get_data (): Record<string, unknown> {
return this.data;
}
}