Sha256: d0b06f57c671d790cddc98a46c373693f1d1f186ac0dde6e144e1d3f4a2c2a56
Contents?: true
Size: 741 Bytes
Versions: 26
Compression:
Stored size: 741 Bytes
Contents
import { isAbsoluteUrl } from './isAbsoluteUrl' /** * Returns an absolute URL based on the given path. */ export function getAbsoluteUrl(path: string, baseUrl?: string): string { // already absolute URL if (isAbsoluteUrl(path)) { return path } // Ignore path with pattern start with * if (path.startsWith('*')) { return path } // Resolve a relative request URL against a given custom "baseUrl" // or the document baseURI (in the case of browser/browser-like environments). const origin = baseUrl || (typeof document !== 'undefined' && document.baseURI) return origin ? // Encode and decode the path to preserve escaped characters. decodeURI(new URL(encodeURI(path), origin).href) : path }
Version data entries
26 entries across 26 versions & 1 rubygems