Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-use-query-params

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-use-query-params - npm Package Compare versions

Comparing version 1.0.3 to 2.0.1

2

dist/index.d.ts

@@ -1,2 +0,2 @@

export { useQueryParams, appendQueryParamsToURL, makeLocation, ParamValuesArray, DefaultParamsObject, AllParams, InputParams, } from './useQueryParams';
export { useQueryParams, type TDefaultParamsObject, type TAllParams, } from './useQueryParams';
//# sourceMappingURL=index.d.ts.map

@@ -1,6 +0,2 @@

export { useQueryParams,
//
appendQueryParamsToURL, makeLocation,
//
ParamValuesArray, } from './useQueryParams';
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiLi9zcmMvIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQ0gsY0FBYztBQUNkLEVBQUU7QUFDRixzQkFBc0IsRUFDdEIsWUFBWTtBQUNaLEVBQUU7QUFDRixnQkFBZ0IsR0FJbkIsTUFBTSxrQkFBa0IsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCB7XG4gICAgdXNlUXVlcnlQYXJhbXMsXG4gICAgLy9cbiAgICBhcHBlbmRRdWVyeVBhcmFtc1RvVVJMLFxuICAgIG1ha2VMb2NhdGlvbixcbiAgICAvL1xuICAgIFBhcmFtVmFsdWVzQXJyYXksXG4gICAgRGVmYXVsdFBhcmFtc09iamVjdCxcbiAgICBBbGxQYXJhbXMsXG4gICAgSW5wdXRQYXJhbXMsXG59IGZyb20gJy4vdXNlUXVlcnlQYXJhbXMnO1xuIl19
export { useQueryParams, } from './useQueryParams';
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiLi9zcmMvIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQ0gsY0FBYyxHQUlqQixNQUFNLGtCQUFrQixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHtcbiAgICB1c2VRdWVyeVBhcmFtcyxcbiAgICAvL1xuICAgIHR5cGUgVERlZmF1bHRQYXJhbXNPYmplY3QsXG4gICAgdHlwZSBUQWxsUGFyYW1zLFxufSBmcm9tICcuL3VzZVF1ZXJ5UGFyYW1zJztcbiJdfQ==

@@ -1,24 +0,7 @@

export declare class ParamValuesArray extends Array<string> {
toString(): string;
}
export type DefaultParamsObject = Record<string, any>;
export type AllParams<PARAMS extends DefaultParamsObject> = Partial<Record<keyof PARAMS, ParamValuesArray>>;
export type InputParams<PARAMS extends DefaultParamsObject> = Partial<{
[KEY in keyof PARAMS]: PARAMS[KEY] extends string[] ? string[] : [string] | string;
}>;
export declare function appendQueryParamsToURL<PARAMS extends DefaultParamsObject>(url: URL, queryParams: InputParams<PARAMS>): void;
export declare function makeLocation<PARAMS extends DefaultParamsObject = DefaultParamsObject>(url: string, queryParams?: InputParams<PARAMS>): URL;
export declare function useQueryParams<PARAMS extends DefaultParamsObject = DefaultParamsObject>(): {
location: string;
getParam: <KEY extends keyof PARAMS>(paramKey: PARAMS[KEY] extends string ? KEY : never) => string | undefined;
getParams: <KEY_1 extends keyof PARAMS>(paramKey: PARAMS[KEY_1] extends string[] ? KEY_1 : never) => string[];
hasParam: (paramKey: keyof PARAMS) => boolean;
setLocation: (url: string | URL, queryParams?: InputParams<PARAMS>, replace?: boolean) => void;
makeLocation: (url: string, queryParams: InputParams<PARAMS>) => URL;
mergeParams: (queryParams: InputParams<PARAMS>, replace?: boolean) => void;
setParams: (queryParams: InputParams<PARAMS>, replace?: boolean) => void;
removeParam: (paramKeys: keyof PARAMS | Partial<{ [key in keyof PARAMS]: boolean; }> | (keyof PARAMS)[], replace?: boolean) => void;
removeParams: (paramKeys: keyof PARAMS | Partial<{ [key in keyof PARAMS]: boolean; }> | (keyof PARAMS)[], replace?: boolean) => void;
readonly allParams: Partial<Record<keyof PARAMS, ParamValuesArray>>;
export type TDefaultParamsObject = Record<string, any>;
export type TAllParams<PARAMS extends TDefaultParamsObject> = {
[key in keyof PARAMS]: string[];
};
export declare function applyQueryParams<PARAMS extends TDefaultParamsObject>(target: URL | URLSearchParams, queryParams: TAllParams<PARAMS>, removeExtras?: boolean): URL | URLSearchParams;
export declare function useQueryParams<PARAMS extends TDefaultParamsObject = TDefaultParamsObject>(): readonly [TAllParams<PARAMS>, (nextParams: TAllParams<PARAMS> | ((current: TAllParams<PARAMS>) => TAllParams<PARAMS>), replace?: boolean) => void];
//# sourceMappingURL=useQueryParams.d.ts.map

@@ -23,52 +23,20 @@ import { useCallback, useEffect, useMemo, useReducer, useRef } from 'react';

})(window.history);
// Exactly the same as Array<string> but with a custom toString
// method that always returns the first value
export class ParamValuesArray extends Array {
toString() {
if (this.length > 0) {
return `${this[0]}`;
}
return '';
export function applyQueryParams(target, queryParams, removeExtras = false) {
const params = target instanceof URL ? target.searchParams : target;
if (removeExtras) {
params.forEach((value, key) => {
if (!(key in queryParams)) {
params.delete(key);
}
});
}
}
export function appendQueryParamsToURL(url, queryParams) {
for (const [key, values] of Object.entries(queryParams)) {
const usableValues = Array.isArray(values) ? values : [values];
url.searchParams.delete(key);
params.delete(key);
for (const value of usableValues) {
url.searchParams.append(key, value);
params.append(key, value);
}
}
return target;
}
export function makeLocation(url, queryParams = {}) {
const isFullURL = url.includes('http://') || url.includes('https://');
const isAbsolute = !isFullURL && url.startsWith('/');
const nextURL = (() => {
if (isFullURL) {
return new URL(url);
}
else {
const nextURL = new URL(window.location.href);
if (isAbsolute) {
const [pathname, query] = url.split('?');
nextURL.pathname = pathname;
nextURL.search = query !== null && query !== void 0 ? query : '';
}
else {
const [pathname, query] = url.split('?');
const urlSegments = nextURL.pathname.split('/');
nextURL.pathname = [
...urlSegments.slice(0, -1),
pathname.trim()
? pathname
: urlSegments[urlSegments.length - 1],
].join('/');
nextURL.search = query !== null && query !== void 0 ? query : '';
}
return nextURL;
}
})();
appendQueryParamsToURL(nextURL, queryParams);
return nextURL;
}
export function useQueryParams() {

@@ -80,10 +48,10 @@ const currentLocation = window.location.href;

const watching = useRef({});
const pauseWatch = useRef(false);
// stores both the key and the values as an array
// of the params that are being watched
const watch = useCallback((key) => {
if (key in watching.current) {
if (key in watching.current || pauseWatch.current) {
return;
}
const values = urlSearchParams.getAll(String(key));
watching.current[key] = values;
watching.current[key] = urlSearchParams.getAll(String(key));
}, [urlSearchParams, watching]);

@@ -95,2 +63,3 @@ const clearWatch = useCallback(() => {

const [, rerender] = useReducer((state) => state + 1, 0);
// Handles location changes via listener mechanism above.
const handle = useCallback(() => {

@@ -126,82 +95,47 @@ const currentParams = new URLSearchParams(window.location.search);

}, [handle]);
const getParam = (paramKey) => {
var _a;
watch(paramKey);
return (_a = urlSearchParams.get(String(paramKey))) !== null && _a !== void 0 ? _a : undefined;
};
const getParams = (paramKey) => {
watch(paramKey);
return urlSearchParams.getAll(String(paramKey));
};
const hasParam = (paramKey) => {
watch(paramKey);
return urlSearchParams.has(String(paramKey));
};
const setLocation = (url, queryParams = {}, replace = false) => {
const nextURL = url instanceof URL ? url : makeLocation(url, queryParams);
const sameOrigin = nextURL.host === window.location.host &&
nextURL.protocol === window.location.protocol;
// History API only supports same origin URLs
if (sameOrigin) {
const params = useMemo(() => {
return new Proxy({}, {
get(target, key) {
watch(key);
return urlSearchParams.getAll(key);
},
ownKeys(target) {
const keys = new Set();
urlSearchParams.forEach((value, key) => {
keys.add(key);
});
return [...keys];
},
getOwnPropertyDescriptor(target, prop) {
return { configurable: true, enumerable: true, writable: false };
},
has(target, key) {
watch(key);
return urlSearchParams.has(key);
},
});
}, [urlSearchParams]);
const setParams = useCallback((nextParams, replace = false) => {
try {
const nextURL = new URL(window.location.href);
pauseWatch.current = true;
const nextParamsObject = nextParams instanceof Function
? nextParams(params)
: nextParams;
pauseWatch.current = false;
applyQueryParams(nextURL, nextParamsObject);
if (replace) {
window.history.replaceState(null, '', nextURL.href);
window.history.replaceState(null, '', nextURL);
}
else {
window.history.pushState(null, '', nextURL.href);
window.history.pushState(null, '', nextURL);
}
}
else {
window.location.href = nextURL.href;
catch (error) {
console.error('Error while setting query params', error);
}
};
const mergeParams = (queryParams, replace = false) => {
// merging is the default behaviour of the setLocation
setLocation(window.location.href, queryParams, replace);
};
const setParams = (queryParams, replace = false) => {
const url = new URL(window.location.href);
// must clear the search params first as
// expected behaviour is replacement
url.search = '';
setLocation(url.href, queryParams, replace);
};
const removeParams = (paramKeys, replace = false) => {
const url = new URL(window.location.href);
const usableKeys = Array.isArray(paramKeys)
? paramKeys
: paramKeys instanceof Object
? Object.entries(paramKeys)
.filter(([, value]) => value)
.map(([key]) => key)
: [paramKeys];
for (const key of usableKeys) {
url.searchParams.delete(key);
}
setLocation(url, {}, replace);
};
return {
location: currentLocation,
getParam: getParam,
getParams: getParams,
hasParam: hasParam,
setLocation: setLocation,
makeLocation: (url, queryParams) => makeLocation(url, queryParams),
mergeParams: mergeParams,
setParams: setParams,
removeParam: removeParams,
removeParams: removeParams,
get allParams() {
const keys = new Set();
urlSearchParams.forEach((_, key) => {
keys.add(key);
});
const allParams = {};
for (const key of keys) {
watch(key);
allParams[key] = ParamValuesArray.from(urlSearchParams.getAll(String(key)));
}
return allParams;
},
};
pauseWatch.current = false;
}, [params]);
return [params, setParams];
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlUXVlcnlQYXJhbXMuanMiLCJzb3VyY2VSb290IjoiLi9zcmMvIiwic291cmNlcyI6WyJ1c2VRdWVyeVBhcmFtcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUMsV0FBVyxFQUFFLFNBQVMsRU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0gZWxzZSB7XG4gICAgICAgICAgICBjb25zdCBuZXh0VVJMID0gbmV3IFVSTCh3aW5kb3cubG9jYXRpb24uaHJlZik7XG5cbiAgICAgICAgICAgIGlmIChpc0Fic29sdXRlKSB7XG4gICAgICAgICAgICAgICAgY29uc3QgW3BhdGhuYW1lLCBxdWVyeV0gPSB1cmwuc3BsaXQoJz8nKTtcblxuICAgICAgICAgICAgICAgIG5leHRVUkwucGF0aG5hbWUgPSBwYXRobmFtZTtcbiAgICAgICAgICAgICAgICBuZXh0VVJMLnNlYXJjaCA9IHF1ZXJ5ID8/ICcnO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBjb25zdCBbcGF0aG5hbWUsIHF1ZXJ5XSA9IHVybC5zcGxpdCgnPycpO1xuXG4gICAgICAgICAgICAgICAgY29uc3QgdXJsU2VnbWVudHMgPSBuZXh0VVJMLnBhdGhuYW1lLnNwbGl0KCcvJyk7XG5cbiAgICAgICAgICAgICAgICBuZXh0VVJMLnBhdGhuYW1lID0gW1xuICAgICAgICAgICAgICAgICAgICAuLi51cmxTZWdtZW50cy5zbGljZSgwLCAtMSksXG4gICAgICAgICAgICAgICAgICAgIHBhdGhuYW1lLnRyaW0oKVxuICAgICAgICAgICAgICAgICAgICAgICAgPyBwYXRobmFtZVxuICAgICAgICAgICAgICAgICAgICAgICAgOiB1cmxTZWdtZW50c1t1cmxTZWdtZW50cy5sZW5ndGggLSAxXSxcbiAgICAgICAgICAgICAgICBdLmpvaW4oJy8nKTtcblxuICAgICAgICAgICAgICAgIG5leHRVUkwuc2VhcmNoID0gcXVlcnkgPz8gJyc7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBuZXh0VVJMO1xuICAgICAgICB9XG4gICAgfSkoKTtcblxuICAgIGFwcGVuZFF1ZXJ5UGFyYW1zVG9VUkwobmV4dFVSTCwgcXVlcnlQYXJhbXMpO1xuXG4gICAgcmV0dXJuIG5leHRVUkw7XG59XG5c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KTtcbiAgICB9O1xuXG4gICAgY29uc3QgcmVtb3ZlUGFyYW1zID0gKFxuICAgICAgICBwYXJhbUtleXM6XG4gICAgICAgICAgICB8IGtleW9mIFBBUkFNU1xuICAgICAgICAgICAgfCAoa2V5b2YgUEFSQU1TKVtdXG4gICAgICAgICAgICB8IFBhcnRpYWw8e1xuICAgICAgICAgICAgICAgICAgW2tleSBpbiBrZXlvZiBQQVJBTVNdOiBib29sZWFuO1xuICAgICAgICAgICAgICB9PixcbiAgICAgICAgcmVwbGFjZTogYm9vbGVhbiA9IGZhbHNlLFxuICAgICkgPT4ge1xuICAgICAgICBjb25zdCB1cmwgPSBuZXcgVVJMKHdpbmRvdy5sb2NhdGlvbi5ocmVmKTtcblxuICAgICAgICBjb25zdCB1c2FibGVLZXlzID0gQXJyYXkuaXNBcnJheShwYXJhbUtleXMpXG4gICAgICAgICAgICA/IHBhcmFtS2V5c1xuICAgICAgICAgICAgOiBwYXJhbUtleXMgaW5zdGFuY2VvZiBPYmplY3RcbiAgICAgICAgICAgID8gT2JqZWN0LmVudHJpZXMocGFyYW1LZXlzKVxuICAgICAgICAgICAgICAgICAgLmZpbHRlcigoWywgdmFsdWVdKSA9PiB2YWx1ZSlcbiAgICAgICAgICAgICAgICAgIC5tYXAoKFtrZXldKSA9PiBrZXkpXG4gICAgICAgICAgICA6IFtwYXJhbUtleXNdO1xuXG4gICAgICAgIGZvciAoY29uc3Qga2V5IG9mIHVzYWJsZUtleXMpIHtcbiAgICAgICAgICAgIHVybC5zZWFyY2hQYXJhbXMuZGVsZXRlKGtleSBhcyBzdHJpbmcpO1xuICAgICAgICB9XG5cbiAgICAgICAgc2V0TG9jYXRpb24odXJsLCB7fSwgcmVwbGFjZSk7XG4gICAgfTtcblxuICAgIHJldHVybiB7XG4gICAgICAgIGxvY2F0aW9uOiBjdXJyZW50TG9jYXRpb24sXG4gICAgICAgIGdldFBhcmFtOiBnZXRQYXJhbSxcbiAgICAgICAgZ2V0UGFyYW1zOiBnZXRQYXJhbXMsXG4gICAgICAgIGhhc1BhcmFtOiBoYXNQYXJhbSxcbiAgICAgICAgc2V0TG9jYXRpb246IHNldExvY2F0aW9uLFxuICAgICAgICBtYWtlTG9jYXRpb246ICh1cmw6IHN0cmluZywgcXVlcnlQYXJhbXM6IElucHV0UGFyYW1zPFBBUkFNUz4pID0+XG4gICAgICAgICAgICBtYWtlTG9jYXRpb24odXJsLCBxdWVyeVBhcmFtcyksXG4gICAgICAgIG1lcmdlUGFyYW1zOiBtZXJnZVBhcmFtcyxcbiAgICAgICAgc2V0UGFyYW1zOiBzZXRQYXJhbXMsXG4gICAgICAgIHJlbW92ZVBhcmFtOiByZW1vdmVQYXJhbXMsXG4gICAgICAgIHJlbW92ZVBhcmFtczogcmVtb3ZlUGFyYW1zLFxuICAgICAgICBnZXQgYWxsUGFyYW1zKCkge1xuICAgICAgICAgICAgY29uc3Qga2V5cyA9IG5ldyBTZXQ8c3RyaW5nPigpO1xuXG4gICAgICAgICAgICB1cmxTZWFyY2hQYXJhbXMuZm9yRWFjaCgoXywga2V5KSA9PiB7XG4gICAgICAgICAgICAgICAga2V5cy5hZGQoa2V5KTtcbiAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICBjb25zdCBhbGxQYXJhbXM6IEFsbFBhcmFtczxQQVJBTVM+ID0ge307XG5cbiAgICAgICAgICAgIGZvciAoY29uc3Qga2V5IG9mIGtleXMpIHtcbiAgICAgICAgICAgICAgICB3YXRjaChrZXkpO1xuXG4gICAgICAgICAgICAgICAgYWxsUGFyYW1zW2tleSBhcyBrZXlvZiBQQVJBTVNdID0gUGFyYW1WYWx1ZXNBcnJheS5mcm9tKFxuICAgICAgICAgICAgICAgICAgICB1cmxTZWFyY2hQYXJhbXMuZ2V0QWxsKFN0cmluZyhrZXkpKSxcbiAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gYWxsUGFyYW1zO1xuICAgICAgICB9LFxuICAgIH07XG59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ICAgICAgICAgICAgY29uc3QgY3VycmVudFZhbHVlcyA9IGN1cnJlbnRQYXJhbXMuZ2V0QWxsKGtleSk7XG5cbiAgICAgICAgICAgIGlmIChjdXJyZW50VmFsdWVzLmxlbmd0aCAhPT0gdmFsdWVzPy5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICBzaG91bGRSZXJlbmRlciA9IHRydWU7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIC8vIHRoZSBmaXJzdCBtaXNtYXRjaGVkIHZhbHVlIG1lYW5zIHdlIG5lZWQgdG8gcmVyZW5kZXJcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgY3VycmVudFZhbHVlcy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgIGlmIChjdXJyZW50VmFsdWVzW2ldICE9PSB2YWx1ZXNbaV0pIHtcbiAgICAgICAgICAgICAgICAgICAgc2hvdWxkUmVyZW5kZXIgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoc2hvdWxkUmVyZW5kZXIpIHtcbiAgICAgICAgICAgIGNsZWFyV2F0Y2goKTtcbiAgICAgICAgICAgIHJlcmVuZGVyKCk7XG4gICAgICAgIH1cbiAgICB9LCBbd2F0Y2hpbmcsIGNsZWFyV2F0Y2gsIHJlcmVuZGVyXSk7XG5cbiAgICB1c2VFZmZlY3QoKCkgPT4ge1xuICAgICAgICAvLyBsaXN0ZW5pbmcgb24gdGhlIGdsb2JhbCB3aW5kb3cgb2JqZWN0XG4gICAgICAgIC8vIHZpYSBpbnRlcmNlcHRpb25zIGFuZCBsaXN0ZW5lcnMuXG4gICAgICAgIGxpc3RlbmVycy5hZGQoaGFuZGxlKTtcblxuICAgICAgICByZXR1cm4gKCkgPT4ge1xuICAgICAgICAgICAgbGlzdGVuZXJzLmRlbGV0ZShoYW5kbGUpO1xuICAgICAgICB9O1xuICAgIH0sIFtoYW5kbGVdKTtcblxuICAgIGNvbnN0IHBhcmFtcyA9IHVzZU1lbW8oKCkgPT4ge1xuICAgICAgICByZXR1cm4gbmV3IFByb3h5KHt9IGFzIFRBbGxQYXJhbXM8UEFSQU1TPiwge1xuICAgICAgICAgICAgZ2V0KHRhcmdldCwga2V5OiBzdHJpbmcpOiBzdHJpbmdbXSB7XG4gICAgICAgICAgICAgICAgd2F0Y2goa2V5KTtcbiAgICAgICAgICAgICAgICByZXR1cm4gdXJsU2VhcmNoUGFyYW1zLmdldEFsbChrZXkpO1xuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIG93bktleXModGFyZ2V0KSB7XG4gICAgICAgICAgICAgICAgY29uc3Qga2V5cyA9IG5ldyBTZXQ8c3RyaW5nPigpO1xuXG4gICAgICAgICAgICAgICAgdXJsU2VhcmNoUGFyYW1zLmZvckVhY2goKHZhbHVlLCBrZXkpID0+IHtcbiAgICAgICAgICAgICAgICAgICAga2V5cy5hZGQoa2V5KTtcbiAgICAgICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgICAgIHJldHVybiBbLi4ua2V5c107XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHRhcmdldCwgcHJvcCkge1xuICAgICAgICAgICAgICAgIHJldHVybiB7Y29uZmlndXJhYmxlOiB0cnVlLCBlbnVtZXJhYmxlOiB0cnVlLCB3cml0YWJsZTogZmFsc2V9O1xuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGhhcyh0YXJnZXQsIGtleTogc3RyaW5nKSB7XG4gICAgICAgICAgICAgICAgd2F0Y2goa2V5KTtcbiAgICAgICAgICAgICAgICByZXR1cm4gdXJsU2VhcmNoUGFyYW1zLmhhcyhrZXkpO1xuICAgICAgICAgICAgfSxcbiAgICAgICAgfSk7XG4gICAgfSwgW3VybFNlYXJjaFBhcmFtc10pO1xuXG4gICAgY29uc3Qgc2V0UGFyYW1zID0gdXNlQ2FsbGJhY2soXG4gICAgICAgIChcbiAgICAgICAgICAgIG5leHRQYXJhbXM6XG4gICAgICAgICAgICAgICAgfCBUQWxsUGFyYW1zPFBBUkFNUz5cbiAgICAgICAgICAgICAgICB8ICgoY3VycmVudDogVEFsbFBhcmFtczxQQVJBTVM+KSA9PiBUQWxsUGFyYW1zPFBBUkFNUz4pLFxuICAgICAgICAgICAgcmVwbGFjZTogYm9vbGVhbiA9IGZhbHNlLFxuICAgICAgICApID0+IHtcbiAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgY29uc3QgbmV4dFVSTCA9IG5ldyBVUkwod2luZG93LmxvY2F0aW9uLmhyZWYpO1xuXG4gICAgICAgICAgICAgICAgcGF1c2VXYXRjaC5jdXJyZW50ID0gdHJ1ZTtcblxuICAgICAgICAgICAgICAgIGNvbnN0IG5leHRQYXJhbXNPYmplY3QgPVxuICAgICAgICAgICAgICAgICAgICBuZXh0UGFyYW1zIGluc3RhbmNlb2YgRnVuY3Rpb25cbiAgICAgICAgICAgICAgICAgICAgICAgID8gbmV4dFBhcmFtcyhwYXJhbXMpXG4gICAgICAgICAgICAgICAgICAgICAgICA6IG5leHRQYXJhbXM7XG5cbiAgICAgICAgICAgICAgICBwYXVzZVdhdGNoLmN1cnJlbnQgPSBmYWxzZTtcblxuICAgICAgICAgICAgICAgIGFwcGx5UXVlcnlQYXJhbXMobmV4dFVSTCwgbmV4dFBhcmFtc09iamVjdCk7XG5cbiAgICAgICAgICAgICAgICBpZiAocmVwbGFjZSkge1xuICAgICAgICAgICAgICAgICAgICB3aW5kb3cuaGlzdG9yeS5yZXBsYWNlU3RhdGUobnVsbCwgJycsIG5leHRVUkwpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHdpbmRvdy5oaXN0b3J5LnB1c2hTdGF0ZShudWxsLCAnJywgbmV4dFVSTCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICAgICAgICBjb25zb2xlLmVycm9yKCdFcnJvciB3aGlsZSBzZXR0aW5nIHF1ZXJ5IHBhcmFtcycsIGVycm9yKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcGF1c2VXYXRjaC5jdXJyZW50ID0gZmFsc2U7XG4gICAgICAgIH0sXG4gICAgICAgIFtwYXJhbXNdLFxuICAgICk7XG5cbiAgICByZXR1cm4gW3BhcmFtcywgc2V0UGFyYW1zXSBhcyBjb25zdDtcbn1cbiJdfQ==
{
"name": "react-use-query-params",
"version": "1.0.3",
"version": "2.0.1",
"description": "Strongly typed, routing-library agnostic react hook to use and manipulate query params",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc