UNPKG

@enonic/mock-xp

Version:

Mock Enonic XP API JavaScript Library

36 lines (35 loc) 1.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ResourceKey = void 0; var ResourceKey = (function () { function ResourceKey(_a) { var applicationKey = _a.applicationKey, path = _a.path; this.applicationKey = applicationKey; this.path = path; } ResourceKey.prototype.getApplicationKey = function () { return this.applicationKey; }; ResourceKey.prototype.getPath = function () { return this.path; }; ResourceKey.prototype.getUri = function () { return "".concat(this.applicationKey, ":").concat(this.path); }; ResourceKey.prototype.isRoot = function () { return this.path === '/'; }; ResourceKey.prototype.getName = function () { if (this.isRoot()) { return ''; } var pos = this.path.lastIndexOf('/'); return this.path.substring(pos + 1); }; ResourceKey.prototype.getExtension = function () { var pos = this.path.lastIndexOf('.'); return pos > 0 ? this.path.substring(pos + 1) : null; }; return ResourceKey; }()); exports.ResourceKey = ResourceKey;