UNPKG

@caidrive/shared

Version:

caidrive.shared.components

55 lines (54 loc) 1.01 kB
"use strict"; /** * What it does. * * @param name - Parameter description. * @returns Type and description of the returned object. * * @example * ``` * Write me later. * ``` */ Object.defineProperty(exports, "__esModule", { value: true }); exports.Entity = void 0; const unique_id_1 = require("./unique.id"); class Entity { /* * */ constructor(props, id) { this.props = props; this._id = id || new unique_id_1.UniqueId(); } /* * */ static isEntity(e) { return e instanceof Entity; } /* * */ equals(entity) { /* */ if (entity === null || entity === undefined) { return false; } /* */ if (!Entity.isEntity(entity)) { return false; } /* */ if (this === entity) { return true; } /* */ return this._id.equals(entity._id); } } exports.Entity = Entity;