forked from quic-issues/427e7578-d7bf-49c8-aee9-2dd999e25316
implemented frontend including separate message system; started to implement backend
This commit is contained in:
46
yjs-poll/node_modules/lib0/dist/url.cjs
generated
vendored
Normal file
46
yjs-poll/node_modules/lib0/dist/url.cjs
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var object = require('./object-c0c9435b.cjs');
|
||||
require('./equality.cjs');
|
||||
|
||||
/**
|
||||
* Utility module to work with urls.
|
||||
*
|
||||
* @module url
|
||||
*/
|
||||
|
||||
/**
|
||||
* Parse query parameters from an url.
|
||||
*
|
||||
* @param {string} url
|
||||
* @return {Object<string,string>}
|
||||
*/
|
||||
const decodeQueryParams = url => {
|
||||
/**
|
||||
* @type {Object<string,string>}
|
||||
*/
|
||||
const query = {};
|
||||
const urlQuerySplit = url.split('?');
|
||||
const pairs = urlQuerySplit[urlQuerySplit.length - 1].split('&');
|
||||
for (let i = 0; i < pairs.length; i++) {
|
||||
const item = pairs[i];
|
||||
if (item.length > 0) {
|
||||
const pair = item.split('=');
|
||||
query[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1] || '');
|
||||
}
|
||||
}
|
||||
return query
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Object<string,string>} params
|
||||
* @return {string}
|
||||
*/
|
||||
const encodeQueryParams = params =>
|
||||
object.map(params, (val, key) => `${encodeURIComponent(key)}=${encodeURIComponent(val)}`).join('&');
|
||||
|
||||
exports.decodeQueryParams = decodeQueryParams;
|
||||
exports.encodeQueryParams = encodeQueryParams;
|
||||
//# sourceMappingURL=url.cjs.map
|
||||
Reference in New Issue
Block a user