Socket
Socket
Sign inDemoInstall

@googlicius/build-url

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.2 to 1.0.3

6

package.json
{
"name": "@googlicius/build-url",
"version": "1.0.2",
"version": "1.0.3",
"description": "Build url helper",

@@ -16,3 +16,5 @@ "main": "dist/index.js",

"test": "jest",
"prepare": "husky install"
"prepare": "husky install",
"publish": "yarn build && npm publish --access-public",
"publish:dry-run": "yarn build && npm publish --access-public --dry-run"
},

@@ -19,0 +21,0 @@ "devDependencies": {

@@ -1,2 +0,2 @@

# BUILD URL
# Build URL

@@ -31,7 +31,5 @@ A helper to build url with query params as easy way. Helpful when your application routing or state management based on URL query params.

Add another query param:
Add another query param
```javascript
import buildUrl from '@googlicius/build-url';
buildUrl('http://my-website.com/post?page=2', {

@@ -46,5 +44,17 @@ queryParams: {

Remove a query param:
Input url/path is omitted
```javascript
buildUrl({
queryParams: {
sort: 'title:asc',
},
});
// Output: /?sort=title%3Aasc
```
Remove a query param
```javascript
buildUrl('images?page=2&sort=title:asc', {

@@ -55,3 +65,22 @@ queryParams: {

});
// Output: /images?sort=title%3Aasc
```
Always returns absolute url
```javascript
// Assume that current url is: http://awesome-website.com
buildUrl('/posts', {
returnAbsoluteUrl: true,
queryParams: {
page: 2,
},
});
// Output: http://awesome-website.com/posts?page=2
```
## License
MIT
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc