UNPKG

tcx-builder

Version:
50 lines (49 loc) 2.11 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 CourseFolder = /** @class */ (function (_super) { __extends(CourseFolder, _super); function CourseFolder(attributes, options) { var _this = _super.call(this) || this; _this.attributes = attributes; _this.Folder = options.folder; _this.CourseNameRef = options.courseNameRef; _this.Notes = options.notes; return _this; } CourseFolder.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.CourseNameRef) && this.CourseNameRef.length) { var courseElements = this.CourseNameRef .map(function (_course) { return _common_1.BaseObject.buildXmlNode('CourseNameRef', _course.toXml()); }) .join('\n'); xmlElement += courseElements; } if (!lodash_1.isNil(this.Notes)) { xmlElement += _common_1.BaseObject.buildXmlNode('Notes', this.Notes); } return xmlElement; }; return CourseFolder; }(_common_1.BaseObject)); exports.CourseFolder = CourseFolder;