Filter url query parameters with a whitelist
npm i whitelist-query-params
# Or with Yarn
yarn add whitelist-query-params
import whitelistQueryParams from 'whitelist-query-params';
const url = whitelistQueryParams('http://www.example.org/?foo=bar&baz=qux', ['foo']);
console.log(url); // http://www.example.org/?foo=bar
See the contribute file!
PRs accepted.