url
URL url parse utility
Author: treelite(c.xinle@gmail.com)
- url
- url ⏏
- new url(data)
- .parse(str) ⇒
Object
- .resolve(from, [to]) ⇒
string
- .param(obj) ⇒
string
- url ⏏
url ⏏
new url(data)
创建URI对象
Param | Type | Description |
---|---|---|
data | string | Object |
uri |
url.parse(str) ⇒ Object
解析URI字符串
Kind: static method of url
Returns: Object
- The URL Object
Param | Type | Description |
---|---|---|
str | string |
URI字符串 |
url.resolve(from, [to]) ⇒ string
resolve path
Kind: static method of url
Param | Type | Description |
---|---|---|
from | string |
起始路径 |
[to] | string |
目标路径 |
url.param(obj) ⇒ string
Format a plain object into query string.
Kind: static method of url
Returns: string
- The result query string.
Param | Type | Description |
---|---|---|
obj | Object |
The object to be formated. |
Example
param({foo:'bar ', bar: 'foo'}); // yields "foo=bar%20&bar=foo"