How to use the resolve function from url
Find comprehensive JavaScript url.resolve code examples handpicked from public code repositorys.
GitHub: Eyevinn/hls-splice
122 123 124 125 126 127 128 129 130 131
return reject(NOT_MULTIVARIANT_ERROR_MSG); } for (let i = 0; i < m3u.items.StreamItem.length; i++) { const streamItem = m3u.items.StreamItem[i]; const mediaManifestUrl = url.resolve(baseUrl, streamItem.get("uri")); mediaManifestPromises.push( this.loadMediaManifest(mediaManifestUrl, streamItem.get("bandwidth"), _injectMediaManifest) ); }
3
14
0
+ 8 other calls in file
98 99 100 101 102 103 104 105 106 107
return false } self.redirectsFollowed += 1 if (!isUrl.test(redirectTo)) { redirectTo = url.resolve(request.uri.href, redirectTo) } var uriPrev = request.uri request.uri = url.parse(redirectTo)
0
0
1
26 27 28 29 30 31 32 33 34 35
const out = await Promise.all( list.slice(0, 4).map(async (elem) => { const $ = cheerio.load(elem); const title = $('div > h5 > a').text(); const partial = $('div > h5 > a').attr('href'); const address = url.resolve(base, partial); const pubDate = date($('span').first().text()); // const keywords = $('span') // .last()
0
0
1
GitHub: rainlighter/RSSHub-0528
15 16 17 18 19 20 21 22 23 24
const $ = cheerio.load(data); const list = $('div.odd,div.even'); const out = list .slice(0, 10) .map(async (i, item) => { const link = url.resolve(base_url, $(item).find('a.post').attr('href')); const description = await ctx.cache.tryGet(link, async () => { const result = await got({ method: 'get', url: link,
0
0
1
GitHub: rainlighter/RSSHub-0528
16 17 18 19 20 21 22 23 24 25
// return false; }) .map(async (item) => { let $ = cheerio.load(item); const $url = url.resolve(current.url, $('a').attr('href')); // 加载新闻内容页面 const response = await got({ method: 'get',
0
0
1
+ 2 other calls in file
408 409 410 411 412 413 414 415 416 417
url.format(Object.assign(currentUrlParts, { host: currentHost })); // Determine the URL of the redirection var redirectUrl; try { redirectUrl = url.resolve(currentUrl, location); } catch (cause) { this.emit("error", new RedirectionError({ cause: cause })); return;
0
0
1
+ 3 other calls in file
GitHub: felipegenuino/gostBlog
105 106 107 108 109 110 111 112 113 114 115 116
const isAbsoluteInternalImage = isAbsoluteImage && requestedImageUrl.startsWith(siteUrl); // CASE: imagePath is a "protocol relative" url e.g. "//www.gravatar.com/ava..." // by resolving the the imagePath relative to the blog url, we can then // detect if the imagePath is external, or internal. const isRelativeInternalImage = !isAbsoluteImage && url.resolve(siteUrl, requestedImageUrl).startsWith(siteUrl); return isAbsoluteInternalImage || isRelativeInternalImage; }
0
0
0
+ 2 other calls in file
GitHub: H1net/node
213 214 215 216 217 218 219
Defaults to `false`. The `url.parse()` method takes a URL string, parses it, and returns a URL object. ## url.resolve(from, to) <!-- YAML
0
0
2
+ 11 other calls in file