@difizen/mana-app
Version:
39 lines (38 loc) • 1.4 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.URINode = exports.FileTreeContextMenuPath = void 0;
var _manaCommon = require("@difizen/mana-common");
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
var FileTreeContextMenuPath = exports.FileTreeContextMenuPath = ['file-tree-context-menu'];
var URINode;
(function (_URINode) {
function is(arg) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return _typeof(arg) === 'object' && 'uri' in arg && arg.uri instanceof _manaCommon.URI;
}
_URINode.is = is;
function getUri(selection) {
if (is(selection)) {
return selection.uri;
}
if (Array.isArray(selection) && is(selection[0])) {
return selection[0].uri;
}
return undefined;
}
_URINode.getUri = getUri;
function getUris(selection) {
if (is(selection)) {
return [selection.uri];
}
if (Array.isArray(selection)) {
return selection.filter(is).map(function (s) {
return s.uri;
});
}
return [];
}
_URINode.getUris = getUris;
})(URINode || (exports.URINode = URINode = {}));