nurlize
Normalize urls.
The name nurlize
refers to this npm module, nurlize.
The function it creates is called urlize.
Install
npm install nurlize
Status
Use
var urlize = ;var base = ;// 'http://example.com/base'var bop = base// 'http://example.com/basefoo/bar/baz/bop'
urlize(base, [...]) -> url
Normalize uri components. Allows programmatically constructing urls given a base URL.
url.urlize([...]) -> url
The url returned has a function called urlize which does the same thing but with the previous value as the base URL.
Inputs expressed as relative urls this way will always resolve to an absolute
url relative to that base url. Results curried using url.urlize
will
"reset" urlize
to use that url as the new base.
Example
var urlize = ; if !moduleparent var base = ; console; var bop = base console; console; console; var baz = bop console; var foo = baz; console; var rebase = foo; console; var rehost = foo; console;
base http://example.com/basebop http://example.com/basefoo/bar/baz/bopbop http://example.com/baz http://example.com/path/bazz/new/basefoo http://example.com/path/indexrebase http://example.com/.rehost https://rehost.io/another/base