UNPKG

chrobject

Version:

Stores chronicles of plain objects as diffs and snapshots

40 lines (39 loc) 1.05 kB
/** * Creator: Christian Hotz * Company: hydra newmedia GmbH * Date: 11.06.16 * * Copyright hydra newmedia GmbH */ "use strict"; var Diff = (function () { function Diff(diff, objId, entity, creator, timestamp, id, linkId) { this.entity = entity; this.creator = creator; this.obj = diff; this.objId = objId; this.timestamp = timestamp; if (id) { this.id = id; } if (linkId) { this.linkId = linkId; } } Diff.prototype.isEmpty = function () { return this.obj.length === 0; }; Diff.prototype.setId = function (id) { this.id = id; return this; }; Diff.prototype.linkToId = function (linkId) { this.linkId = linkId; return this; }; Diff.prototype.clone = function () { return new Diff(this.obj, this.objId, this.entity, this.creator, this.timestamp, this.id ? this.id : null, this.linkId ? this.linkId : null); }; return Diff; }()); exports.Diff = Diff;