JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 653
  • Score
    100M100P100Q91668F
  • License MIT

a simple tool that allows you to remove any querystring from the url

Package Exports

  • qsm

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (qsm) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Query String Manager

A simple tool that allows you to add and remove any querystring from the url

Install

npm install --save qsm

Usage

qsm.add(string, array) array is an array of objects with {query: 'query', value: 'value'}

qsm.remove(string, string)

qsm.clear(string);

qsm.replace(string, string)


Add

Appends querystring to the url.

var qsm = require('qsm');
var newurl = qsm.add('http://mywebsite.com', [{ query: 'userId', value: 1337 }]);

// newurl outputs: http://mywebsite.com?userId=1337

Remove

Removes any querystring by key

var qsm = require('qsm');
var newurl = qsm.remove('http://mywebsite.com?userId=1337&sort=type', 'userId');

// newurl outputs: http://mywebsite.com?sort=type

Clear

Clears all querystrings from the url

var qsm = require('qsm');
var newurl = qsm.clear('http://mywebsite.com?userId=1337&sort=type');

// newurl outputs: http://mywebsite.com

Replace

Replaces current querystrings with new ones.

var qsm = require('qsm');
var newurl = qsm.replace('http://mywebsite.com?userId=1337&sort=type', [{ query: 'hasObject', value: true }]);

// newurl outputs: http://mywebsite.com?hasObject=true