UNPKG

559 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.constructUrl = void 0;
4var url_1 = require("url");
5exports.constructUrl = function (storybookUrl, id) {
6 var storyUrl = "/iframe.html?id=" + id;
7 var _a = new url_1.URL(storybookUrl), protocol = _a.protocol, host = _a.host, pathname = _a.pathname, search = _a.search;
8 var pname = pathname.replace(/\/$/, ''); // removes trailing /
9 var query = search.replace('?', '&'); // convert leading ? to &
10 return protocol + "//" + host + pname + storyUrl + query;
11};