@difizen/mana-app
Version:
26 lines (25 loc) • 913 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.FileSystemUtils = void 0;
var _manaCommon = require("@difizen/mana-common");
var FileSystemUtils;
(function (_FileSystemUtils) {
function generateUniqueResourceURI(parentUri, parent, name) {
var ext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
var children = !parent.children ? [] : parent.children.map(function (child) {
return child.resource;
});
var index = 1;
var base = name + ext;
while (children.some(function (child) {
return child.path.base === base;
})) {
index += 1;
base = "".concat(name, "_").concat(index).concat(ext);
}
return _manaCommon.URI.resolve(parentUri, base);
}
_FileSystemUtils.generateUniqueResourceURI = generateUniqueResourceURI;
})(FileSystemUtils || (exports.FileSystemUtils = FileSystemUtils = {}));