toRootRelativePath
Transforms a given path to be root relative.
- @param
str- The path or absolute URL to transform. - @returns The root-relative path, or the original absolute URL.
Example
toRootRelativePath('foo/bar') // '/foo/bar'
toRootRelativePath('/foo/bar') // '/foo/bar'
toRootRelativePath('http://google.com/foo/bar') // 'http://google.com/foo/bar'