hook-use-url
Advanced tools
Comparing version 2.0.9 to 2.0.10
{ | ||
"name": "hook-use-url", | ||
"version": "2.0.9", | ||
"version": "2.0.10", | ||
"keywords": [ | ||
@@ -5,0 +5,0 @@ "react-router", |
@@ -39,27 +39,27 @@ `npm i hook-use-url` | ||
| Function | Description | Sample Output | | ||
|------------------------------------|-----------------------------------------------------------------------------------------------------|-------------------------------------------| | ||
| `url.getProtocol()` | Get protocol | `https` | | ||
| `url.getDomain()` | Get domain | `example.com` | | ||
| `url.getDomainWithPort()` | Get domain with port | `example.com:3000` | | ||
| `url.getPort()` | Get port | 3000 | | ||
| `url.getPath()` | Get path | `/some-path` | | ||
| `url.getQuery()` | Get query | `x1=b` | | ||
| `url.getFragment()` | Get fragment | `foo` | | ||
| `url.getUri()` | Get full URI with everything | `https://example.come/some-path?x1=b#foo` | | ||
| `url.getUri()` | Get full URI without protocol, domain, or port | `/some-path?x1=b#foo` | | ||
| `url.get(variable*)` | Get value of `x1` from query `url.get("x1")` | `some-string-value` | | ||
| `url.getAll(variable*)` | Get values of `x1` from query. Always returns an array. `url.getAll("x1")` | `[]`, `["value"]`, `["a", "b"]` | | ||
| `url.removeQuery(variablesToKeep)` | Remove query from URI. May pass in _optional_ array of variables to keep: `url.removeQuery(["x1"])` | `url` object to chain more methods. | | ||
| `url.removeFragment()` | Remove fragment from URI | `url` object to chain more methods. | | ||
| `url.removePath()` | Remove path from URI | `url` object to chain more methods. | | ||
| `url.setPath(value*, doKeepQuery)` | Set path & either keep rest of query/fragment or not. Default is not. `url.setPath("/about", true)` | `url` object to chain more methods. | | ||
| `url.setFragment(value*)` | Set new value for fragment. May be any falsy value or string. `url.setFragment('title')` | `url` object to chain more methods. | | ||
| `url.set(variable*, value*)` | Set value of variable in url `url.set("x1", "y")` | `url` object to chain more methods. | | ||
| `url.add(variable*, value*)` | Add one more value or set 1st value for the variable in url. `url.add("tag", "foo")` | `url` object to chain more methods. | | ||
| `url.subtract(variable*, value*)` | Subtract one value from the variable in url. `url.subtract("tag", "foo")` | `url` object to chain more methods. | | ||
| `url.delete(variable*)` | Delete single or multiple values of the variable. `url.delete("tag", "foo")` | `url` object to chain more methods. | | ||
| `url.push()` | Set URI at browser's address input and push history event to browser's history | `url` object to chain more methods. | | ||
| `url.replace()` | Set URI at browser's address input and replace current history event with new at browser's history | `url` object to chain more methods. | | ||
| Function | Description | Sample Output | | ||
|---------------------------------------------------------|-----------------------------------------------------------------------------------------------------|-------------------------------------------| | ||
| `url.getProtocol()` | Get protocol | `https` | | ||
| `url.getDomain()` | Get domain | `example.com` | | ||
| `url.getDomainWithPort()` | Get domain with port | `example.com:3000` | | ||
| `url.getPort()` | Get port | 3000 | | ||
| `url.getPath()` | Get path | `/some-path` | | ||
| `url.getQuery()` | Get query | `x1=b` | | ||
| `url.getFragment()` | Get fragment | `foo` | | ||
| `url.getUri()` | Get full URI with everything | `https://example.come/some-path?x1=b#foo` | | ||
| `url.getUri()` | Get full URI without protocol, domain, or port | `/some-path?x1=b#foo` | | ||
| `url.get(variable<sub>*</sub>)` | Get value of `x1` from query `url.get("x1")` | `some-string-value` | | ||
| `url.getAll(variable<sub>*</sub>)` | Get values of `x1` from query. Always returns an array. `url.getAll("x1")` | `[]`, `["value"]`, `["a", "b"]` | | ||
| `url.removeQuery(variablesToKeep)` | Remove query from URI. May pass in _optional_ array of variables to keep: `url.removeQuery(["x1"])` | `url` object to chain more methods. | | ||
| `url.removeFragment()` | Remove fragment from URI | `url` object to chain more methods. | | ||
| `url.removePath()` | Remove path from URI | `url` object to chain more methods. | | ||
| `url.setPath(value<sub>*</sub>, doKeepQuery)` | Set path & either keep rest of query/fragment or not. Default is not. `url.setPath("/about", true)` | `url` object to chain more methods. | | ||
| `url.setFragment(value<sub>*</sub>)` | Set new value for fragment. May be any falsy value or string. `url.setFragment('title')` | `url` object to chain more methods. | | ||
| `url.set(variable<sub>*</sub>, value<sub>*</sub>)` | Set value of variable in url `url.set("x1", "y")` | `url` object to chain more methods. | | ||
| `url.add(variable<sub>*</sub>, value<sub>*</sub>)` | Add one more value or set 1st value for the variable in url. `url.add("tag", "foo")` | `url` object to chain more methods. | | ||
| `url.subtract(variable<sub>*</sub>, value<sub>*</sub>)` | Subtract one value from the variable in url. `url.subtract("tag", "foo")` | `url` object to chain more methods. | | ||
| `url.delete(variable<sub>*</sub>)` | Delete single or multiple values of the variable. `url.delete("tag", "foo")` | `url` object to chain more methods. | | ||
| `url.push()` | Set URI at browser's address input and push history event to browser's history | `url` object to chain more methods. | | ||
| `url.replace()` | Set URI at browser's address input and replace current history event with new at browser's history | `url` object to chain more methods. | | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12551