This repository was archived by the owner on May 1, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -56,3 +56,24 @@ export {
5656} from './updateLocation' ;
5757export { encodeQueryParams } from './encodeQueryParams' ;
5858export { decodeQueryParams } from './decodeQueryParams' ;
59+
60+ if ( process . env . NODE_ENV !== 'production' ) {
61+ /*
62+ * run checks to ensure a valid version of query-string is installed
63+ * see https://github.com/pbeshai/use-query-params/issues/127 for discussion
64+ */
65+ const queryStringVersion = require ( 'query-string/package.json' ) . version ;
66+ // simple check of versions since we don't anticipate any new minor v5s and
67+ // don't want to require the semver package as a dependency for just a simple
68+ // dev check.
69+ const validQueryStringInstalled =
70+ / ^ 5 .1 .[ 1 - 9 ] [ 0 - 9 ] * / . test ( queryStringVersion ) ||
71+ / ^ 6 \. / . test ( queryStringVersion ) ;
72+ if ( ! validQueryStringInstalled ) {
73+ throw new Error (
74+ `serialize-query-params requires query-string ^5.1.1 || ^6, ` +
75+ `but ${ queryStringVersion } is installed. Note: you may also ` +
76+ `see this message if you're using use-query-params.`
77+ ) ;
78+ }
79+ }
You can’t perform that action at this time.
0 commit comments