Skip to content

Url.variables.deleteSearchParam

fx-fetch


fx-fetch / Url / deleteSearchParam

const deleteSearchParam: {(url, key, value?): Url; (key, value?): (url) => Url; }

Defined in: packages/fx-fetch/src/Url/deleteSearchParam.ts:72

Deletes search parameters from a Url. If a value is provided, only that value is removed; otherwise, all values for the key are removed.

(url, key, value?): Url

Deletes search parameters from a Url. If a value is provided, only that value is removed; otherwise, all values for the key are removed.

Url

string

SearchParamValueInput

Url

import { Url } from 'fx-fetch';
const url = Url.unsafeMake({
url: 'https://example.com',
searchParams: {
tag: ['new', 'sale'],
},
});
Url.format(url); // 'https://example.com?tag=new&tag=sale'
// Remove specific 'tag' parameter
url.pipe(
Url.deleteSearchParam('tag', 'sale'),
Url.format // 'https://example.com?tag=new'
);
// Remove all 'tag' parameters
url.pipe(
Url.deleteSearchParam('tag'),
Url.format // 'https://example.com'
);

0.1.0

(key, value?): (url) => Url

Deletes search parameters from a Url. If a value is provided, only that value is removed; otherwise, all values for the key are removed.

string

SearchParamValueInput

(url): Url

Url

Url

import { Url } from 'fx-fetch';
const url = Url.unsafeMake({
url: 'https://example.com',
searchParams: {
tag: ['new', 'sale'],
},
});
Url.format(url); // 'https://example.com?tag=new&tag=sale'
// Remove specific 'tag' parameter
url.pipe(
Url.deleteSearchParam('tag', 'sale'),
Url.format // 'https://example.com?tag=new'
);
// Remove all 'tag' parameters
url.pipe(
Url.deleteSearchParam('tag'),
Url.format // 'https://example.com'
);

0.1.0

import { Url } from 'fx-fetch';
const url = Url.unsafeMake({
url: 'https://example.com',
searchParams: {
tag: ['new', 'sale'],
},
});
Url.format(url); // 'https://example.com?tag=new&tag=sale'
// Remove specific 'tag' parameter
url.pipe(
Url.deleteSearchParam('tag', 'sale'),
Url.format // 'https://example.com?tag=new'
);
// Remove all 'tag' parameters
url.pipe(
Url.deleteSearchParam('tag'),
Url.format // 'https://example.com'
);

0.1.0