UNPKG

@difizen/mana-app

Version:

33 lines 1.2 kB
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); } import { URI } from '@difizen/mana-common'; export var FileTreeContextMenuPath = ['file-tree-context-menu']; export 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 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 || (URINode = {}));