MCPcopy Index your code
hub / github.com/pyscript/pyscript / normalize

Function normalize

bridge/index.js:27–40  ·  view source on GitHub ↗
(config, base)

Source from the content-addressed store, hash-verified

25 * @returns {string} - The JSON serialized config.
26 */
27const normalize = async (config, base) => {
28 if (typeof config === 'string') {
29 base = config;
30 config = await fetch(config).then(res => res.json());
31 }
32 if (typeof config.files === 'object') {
33 const files = {};
34 for (const [key, value] of entries(config.files)) {
35 files[key.startsWith('{') ? key : new URL(key, base)] = value;
36 }
37 config.files = files;
38 }
39 return stringify(config);
40};
41
42// this logic is based on a 3 levels cache ...
43const cache = new Map;

Callers 1

getFunction · 0.85

Calls 3

stringifyFunction · 0.85
fetchFunction · 0.50
jsonMethod · 0.45

Tested by

no test coverage detected