@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
24 lines • 1.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.appendQueryParamsToDappURL = appendQueryParamsToDappURL;
const extractDappURLFromManifest_1 = require("./extractDappURLFromManifest");
function appendQueryParamsToDappURL(manifest, queryString = {}) {
const url = (0, extractDappURLFromManifest_1.extractDappURLFromManifest)(manifest);
if (url) {
const searchParams = new URLSearchParams(url.search);
// Append the new query strings to the existing ones
Object.entries(queryString).forEach(([key, value]) => {
if (Array.isArray(value)) {
value.forEach(item => searchParams.append(key, item));
}
else {
searchParams.append(key, value);
}
});
// Update the search property of the URL with the updated search params
url.search = searchParams.toString();
return url;
}
return undefined;
}
//# sourceMappingURL=appendQueryParamsToDappURL.js.map