UNPKG

tcx-builder

Version:
57 lines (56 loc) 2.46 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var _common_1 = require("../_common"); var lodash_1 = require("lodash"); var HistoryFolder = /** @class */ (function (_super) { __extends(HistoryFolder, _super); function HistoryFolder(attributes, options) { var _this = _super.call(this) || this; _this.attributes = attributes; _this.Folder = options.folder; _this.ActivityRef = options.activityRef; _this.Week = options.week; _this.Notes = options.notes; return _this; } HistoryFolder.prototype.toXml = function () { var xmlElement = ''; if (!lodash_1.isNil(this.Folder) && this.Folder.length) { var folderElements = this.Folder .map(function (_folder) { return _common_1.BaseObject.buildXmlNode('Folder', _folder.toXml(), _folder.attributes); }) .join('\n'); xmlElement += folderElements; } if (!lodash_1.isNil(this.ActivityRef) && this.ActivityRef.length) { var activityElements = this.ActivityRef .map(function (_activity) { return _common_1.BaseObject.buildXmlNode('ActivityRef', _activity.toXml()); }) .join('\n'); xmlElement += activityElements; } if (!lodash_1.isNil(this.Week) && this.Week.length) { var weekElements = this.Week .map(function (_week) { return _common_1.BaseObject.buildXmlNode('Week', _week.toXml(), _week.attributes); }) .join('\n'); xmlElement += weekElements; } if (!lodash_1.isNil(this.Notes)) { xmlElement += _common_1.BaseObject.buildXmlNode('Notes', this.Notes); } return xmlElement; }; return HistoryFolder; }(_common_1.BaseObject)); exports.HistoryFolder = HistoryFolder;