Socket
Socket
Sign inDemoInstall

url-parameter-append

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    url-parameter-append

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


Version published
Weekly downloads
708
decreased by-31.06%
Maintainers
1
Created
Weekly downloads
 

Changelog

Source

1.0.1 (2019-12-27)

Bug Fixes

  • include missing files in published package (0a1520a)

Code Refactoring

BREAKING CHANGES

    • Refactor to typescript. Generated output is comparable to previous javascript implementation, no additional functionality changes made.
  • Use github actions build pipeline and semantic release

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 27 Dec 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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