UNPKG

tcx-builder

Version:
46 lines (45 loc) 1.99 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 WorkoutFolder = /** @class */ (function (_super) { __extends(WorkoutFolder, _super); function WorkoutFolder(attributes, options) { var _this = _super.call(this) || this; _this.attributes = attributes; _this.Folder = options.folder; _this.WorkoutNameRef = options.workoutNameRef; return _this; } WorkoutFolder.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.WorkoutNameRef) && this.WorkoutNameRef.length) { var workoutNameRefElements = this.WorkoutNameRef .map(function (_workoutNameRef) { return _common_1.BaseObject.buildXmlNode('WorkoutNameRef', _workoutNameRef.toXml()); }) .join('\n'); xmlElement += workoutNameRefElements; } return xmlElement; }; return WorkoutFolder; }(_common_1.BaseObject)); exports.WorkoutFolder = WorkoutFolder;