MCPcopy
hub / github.com/jackwener/OpenCLI / normalizeJdImageUrl

Function normalizeJdImageUrl

clis/jd/item.js:25–36  ·  view source on GitHub ↗
(rawUrl)

Source from the content-addressed store, hash-verified

23 return text;
24}
25function normalizeJdImageUrl(rawUrl) {
26 if (!rawUrl || typeof rawUrl !== 'string')
27 return '';
28 let url = rawUrl.trim();
29 if (!url)
30 return '';
31 if (url.startsWith('//'))
32 url = `https:${url}`;
33 if (!/^https?:\/\//.test(url))
34 return '';
35 return url;
36}
37function normalizeJdImageSize(url) {
38 return normalizeJdImageUrl(url)
39 .replace(/\/pcpubliccms\/s\d+x\d+_jfs\//, '/pcpubliccms/jfs/')

Callers 3

normalizeJdImageSizeFunction · 0.85
pushFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected