url-params-appender

1.2.4 • Public • Published

url-params-appender

Build Status Coverage Status dependencies Status devDependencies Status Known Vulnerabilities

Npm version Npm downloads Last Commit Npm download size Contributors

A library that builds a URL, adding query parameters, taking priority params into account. This is for very usefull when you want to rebuild the current URL, but add/replace the 'page' and 'pageSize'

Installation

To install with npm:

npm i url-params-appender --save

Usage

Usage with node:

var buildUrl = require('url-params-appender');

buildUrl('https://go/see', 
    {
        page: 1, 
        bbb: 111,
        ccc: 'val'
    }, 
    {
        page:2,
        pageSize:5
    }
);

// returns https://go/see?page=2&bbb=111&ccc=val&pageSize=5

Now also support for query params in baseUrl:

var buildUrl = require('url-params-appender');

buildUrl('https://go/see?name=john', 
    {
        page: 1, 
        bbb: 111,
        ccc: 'val'
    }, 
    {
        page:2,
        pageSize:5
    }
);

// returns https://go/see?name=john&page=2&bbb=111&ccc=val&pageSize=5

Release

How to release:

npm version (major/minor/patch)
git push origin ${tag}

Contribution

If you want to contribute to this project, you can fork the repository and create pull request to have it reviewed by the Sandbox team. Make sure to link the PR to an issue or improvement for tracking purposes.

Contribution Process

License

This is licensed under an MIT License. See details

Readme

Keywords

Package Sidebar

Install

npm i url-params-appender

Weekly Downloads

1

Version

1.2.4

License

MIT

Unpacked Size

5.17 kB

Total Files

4

Last publish

Collaborators

  • jvanhent