Exciting release!Introducing "safe npm". Learn more
Socket
Log inDemoInstall

url-parameter-append

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Issues
File Explorer

Advanced tools

url-parameter-append

A simple method for adding, removing or updating parameters on a querystring

    1.0.5latest
    GitHub

Version published
Maintainers
1
Weekly downloads
616
decreased by-37.53%

Weekly downloads

Changelog

Source

1.0.5 (2021-05-11)

Bug Fixes

  • update dependencies (0dafe6f)

Readme

Source

Url Parameter Append

A quick and easy utility method for adding, updating or removing querystring parameters.

Installation

npm install url-parameter-append

Tests

Tests can be executed using the following:

npm test

How to use

Reference the package:

const urlParameterAppend = require('url-parameter-append');

or

import urlParameterAppend from 'url-parameter-append';

Add querystring:

const url = urlParameterAppend('http://example.com/', 'search', 'test'); console.log(url); http://example.com/?search=test

or

const url = urlParameterAppend('http://example.com/', {search: 'test'}); console.log(url); http://example.com/?search=test

Replace parameter:

const url = urlParameterAppend('http://example.com/?search=test', 'search', 'other'); console.log(url); http://example.com/?search=other

or

const url = urlParameterAppend('http://example.com/?search=test', {search: 'other'}); console.log(url); http://example.com/?search=other

Remove parameter:

const url = urlParameterAppend('http://example.com/?search=test', 'search', null); console.log(url); http://example.com/

or

const url = urlParameterAppend('http://example.com/?search=test', {search: null}); console.log(url); http://example.com/

More examples can be found in url-parameter-append.spec.ts

Tests use the jest testing framework.

Keywords

FAQs

Last updated on 11 May 2021

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket
support@socket.devSocket SOC 2 Logo

Product

  • Package Issues
  • 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