UNPKG

@nivinjoseph/n-domain

Version:

Domain Driven Design and Event Sourcing based framework for business layer implementation

22 lines (18 loc) 596 B
import { Serializable } from "@nivinjoseph/n-util"; // public export abstract class DomainObject<TData extends object = {}> extends Serializable<TData> { /** * @param value (the value to compare) */ public equals(value: DomainObject | null | undefined): boolean { if (value == null) return false; if (value === this) return true; if (value.getTypeName() !== this.getTypeName()) return false; return JSON.stringify(this.serialize()) === JSON.stringify(value.serialize()); } }