abapmerge
Version:
Merge ABAP INCLUDEs into single file
51 lines • 1.71 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var File = /** @class */ (function () {
// object names are unique across packages in ABAP, so
// the folder name is not part of this class
function File(filename, content) {
this.isUsed = false;
this.filename = filename;
this.contents = content;
}
File.prototype.isBinary = function () {
return typeof this.contents !== "string";
};
File.prototype.getName = function () {
return this.filename.split(".")[0];
};
File.prototype.getFilename = function () {
return this.filename;
};
File.prototype.getContents = function () {
if (this.isBinary())
throw Error("Binary file accessed as string [".concat(this.filename, "]"));
return this.contents;
};
File.prototype.getBlob = function () {
if (!this.isBinary())
throw Error("Text file accessed as blob [".concat(this.filename, "]"));
return this.contents;
};
File.prototype.wasUsed = function () {
return this.isUsed;
};
File.prototype.markUsed = function () {
this.isUsed = true;
};
File.prototype.isABAP = function () {
return this.filename.match(/.abap$/) !== null;
};
File.prototype.isPROG = function () {
return this.filename.match(/prog.abap$/) !== null;
};
File.prototype.isMain = function () {
if (!this.isPROG() || this.isBinary()) {
return false;
}
return !!this.getContents().match(/^(\*|\s*")\s*@@abapmerge\s+main\s+void/i);
};
return File;
}());
exports.default = File;
//# sourceMappingURL=file.js.map