use-query-params
Advanced tools
Comparing version 1.1.7 to 1.1.8
import * as React from 'react'; | ||
import { updateUrlQuery, createLocationWithChanges } from './updateUrlQuery'; | ||
export var LocationContext = React.createContext({ | ||
var providerlessContextValue = { | ||
location: {}, | ||
getLocation: function () { return ({}); }, | ||
setLocation: function () { }, | ||
}); | ||
}; | ||
export var LocationContext = React.createContext(providerlessContextValue); | ||
export function useLocationContext() { | ||
var context = React.useContext(LocationContext); | ||
if (process.env.NODE_ENV === 'development' && context === undefined) { | ||
if (process.env.NODE_ENV !== 'production' && | ||
(context === undefined || context === providerlessContextValue)) { | ||
throw new Error('useQueryParams must be used within a QueryParamProvider'); | ||
@@ -12,0 +14,0 @@ } |
@@ -5,10 +5,12 @@ "use strict"; | ||
var updateUrlQuery_1 = require("./updateUrlQuery"); | ||
exports.LocationContext = React.createContext({ | ||
var providerlessContextValue = { | ||
location: {}, | ||
getLocation: function () { return ({}); }, | ||
setLocation: function () { }, | ||
}); | ||
}; | ||
exports.LocationContext = React.createContext(providerlessContextValue); | ||
function useLocationContext() { | ||
var context = React.useContext(exports.LocationContext); | ||
if (process.env.NODE_ENV === 'development' && context === undefined) { | ||
if (process.env.NODE_ENV !== 'production' && | ||
(context === undefined || context === providerlessContextValue)) { | ||
throw new Error('useQueryParams must be used within a QueryParamProvider'); | ||
@@ -15,0 +17,0 @@ } |
{ | ||
"name": "use-query-params", | ||
"version": "1.1.7", | ||
"version": "1.1.8", | ||
"description": "React Hook for managing state in URL query parameters with easy serialization.", | ||
@@ -83,3 +83,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"serialize-query-params": "^1.2.1" | ||
"serialize-query-params": "^1.2.3" | ||
}, | ||
@@ -86,0 +86,0 @@ "husky": { |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
95953
1634
2