UNPKG

donobu

Version:

Create browser automations with an LLM agent and replay them as Playwright scripts.

28 lines 949 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getDisplayText = getDisplayText; exports.getDisplayName = getDisplayName; /** * Mirrors `getDisplayText` from frontend/src/lib/utils.ts. Returns the * hostname for http(s) URLs, the final path segment for file:// URLs, or * the input string unchanged if it can't be parsed as a URL. */ function getDisplayText(url) { try { const parsedUrl = new URL(url); return parsedUrl.protocol === 'file:' ? parsedUrl.pathname.split('/').pop() || url : parsedUrl.hostname; } catch { return url; } } /** * Mirrors the fallback used in frontend FlowsTable for the display name of a * flow, but can also apply to tests. */ function getDisplayName({ name, web }, fallbackName = 'Untitled') { return name ?? getDisplayText(web?.targetWebsite ?? '') ?? fallbackName; } //# sourceMappingURL=displayName.js.map