emsi-lib
Version:
A EMSI (Emergency Management Shared Information) object model to manipulate emergency messages defined in ISO/TR 22351 document
34 lines (33 loc) • 1.29 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.Reference = void 0;
const config_1 = require("../../common/config");
const default_1 = require("../../common/default");
const error_1 = require("../../error");
class Reference extends default_1.Default {
constructor(orgId, otherEventIds) {
error_1.EventError.checkLength(orgId, config_1.MAX_ID_LENGTH);
otherEventIds.forEach(eventId => error_1.EventError.checkLength(eventId, config_1.MAX_ID_LENGTH));
super();
this.orgId = orgId;
this.otherEventId = otherEventIds;
}
static default() {
return new Reference(config_1.NULL_UUID, []);
}
assign(source) {
let key;
const keys = Object.keys(source);
if ((key = keys.find(f => f === 'orgId')))
this.orgId = source[key];
if ((key = keys.find(f => f === 'otherEventId'))) {
this.otherEventId = new Array();
if (source[key] instanceof Array)
source[key].forEach((add) => { var _a; return (_a = this.otherEventId) === null || _a === void 0 ? void 0 : _a.push(add); });
else
this.otherEventId.push(source[key]);
}
return this;
}
}
exports.Reference = Reference;
;