UNPKG

@platform/cell.schema

Version:

URI and database schemas for the `cell.os`.

17 lines (16 loc) 834 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.params = void 0; var tslib_1 = require("tslib"); var ManifestUrl_parse_1 = require("./ManifestUrl.parse"); function params(url, options) { var trim = function (input) { return (input || '').trim(); }; var params = tslib_1.__assign(tslib_1.__assign({}, url.params), options); params.entry = trim(params.entry); var next = "".concat(url.protocol, "://").concat(url.domain, "/").concat(url.path, "?"); var withQuery = function (key, value) { return "".concat(next, "entry=").concat(params[key], "&"); }; Object.keys(params).forEach(function (key) { return (next = withQuery(key, params[key])); }); next = next.replace(/\?$/, '').replace(/&$/, ''); return (0, ManifestUrl_parse_1.parse)(next); } exports.params = params;