UNPKG

abapmerge

Version:

Merge ABAP INCLUDEs into single file

86 lines 3 kB
"use strict"; var __read = (this && this.__read) || function (o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; }; var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); }; Object.defineProperty(exports, "__esModule", { value: true }); var FileList = /** @class */ (function () { function FileList(files) { this.files = files ? [].concat(files) : []; } FileList.prototype.push = function (f) { this.files.push(f); }; FileList.prototype.concat = function (f) { var _a; (_a = this.files).push.apply(_a, __spreadArray([], __read(f.files), false)); }; FileList.prototype.length = function () { return this.files.length; }; FileList.prototype.get = function (i) { return this.files[i]; }; FileList.prototype.fileByName = function (name) { name = name.toLowerCase(); var file = this.files.find(function (f) { return f.getName().toLowerCase() === name.toLowerCase() && f.isABAP(); }); if (file) { file.markUsed(); return file; } throw Error("file not found: ".concat(name)); }; FileList.prototype.otherByName = function (name) { name = name.toLowerCase(); var file = this.files.find(function (f) { return f.getFilename().toLowerCase() === name.toLowerCase() && !f.isABAP(); }); if (file) { file.markUsed(); return file; } throw Error("file not found: ".concat(name)); }; FileList.prototype.validateAllFilesUsed = function (allowUnused) { var unusedFiles = this.files .filter(function (i) { return !i.wasUsed() && (i.isABAP() && !i.isMain()); }) .map(function (i) { return i.getFilename().toLowerCase(); }) .join(", "); if (unusedFiles) { var text = "Not all files used: [".concat(unusedFiles, "]"); if (allowUnused === true) { console.log(text); } else { throw Error(text); } } }; FileList.prototype[Symbol.iterator] = function () { return this.files[Symbol.iterator](); }; return FileList; }()); exports.default = FileList; //# sourceMappingURL=file_list.js.map