Skip to main content
Module

x/querystring/mod.js>exclude

Parse and stringify URL query strings
Latest
function exclude
import { exclude } from "https://deno.land/x/querystring@v1.0.2/mod.js";

Exclude query parameters from a URL. Like .pick() but reversed.

Examples

Example 1

queryString.exclude('https://foo.bar?foo=1&bar=2#hello', ['foo']);
//=> 'https://foo.bar?bar=2#hello'

queryString.exclude('https://foo.bar?foo=1&bar=2#hello', (name, value) => value === 2, {parseNumbers: true});
//=> 'https://foo.bar?foo=1#hello'

Parameters

url: string
  • The URL containing the query parameters to exclude.
keys: readonly string[]
  • The names of the query parameters to remove. All other query parameters will remain in the URL.
optional
options: ParseOptions & StringifyOptions
  • A filter predicate that will be provided the name of each query parameter and its value. The parseNumbers and parseBooleans options also affect value.

Returns

string

The URL without the excluded the query parameters.

Parameters

url: string
filter: (key: string, value: string | boolean | number) => boolean
optional
options: { parseBooleans: true; parseNumbers: true; } & ParseOptions & StringifyOptions

Returns

string

Parameters

url: string
filter: (key: string, value: string | boolean) => boolean
optional
options: { parseBooleans: true; } & ParseOptions & StringifyOptions

Returns

string

Parameters

url: string
filter: (key: string, value: string | number) => boolean
optional
options: { parseNumbers: true; } & ParseOptions & StringifyOptions

Returns

string