UNPKG

solid-panes

Version:

Solid-compatible Panes: applets and views for the mashlib and databrowser

21 lines (18 loc) 725 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _default = dom => function viewAsMbox(obj) { const anchor = dom.createElement('a'); // previous implementation assumed email address was Literal. fixed. // FOAF mboxs must NOT be literals -- must be mailto: URIs. let address = obj.termType === 'NamedNode' ? obj.uri : obj.value; // this way for now // if (!address) return viewAsBoringDefault(obj) const index = address.indexOf('mailto:'); address = index >= 0 ? address.slice(index + 7) : address; anchor.setAttribute('href', 'mailto:' + address); anchor.appendChild(dom.createTextNode(address)); return anchor; }; exports.default = _default;