Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const restoreLocation = (state, {location, locationType = Constants.LOCATION_HISTORY}) => {
const {defaultParams} = state;
const {pathname, search, hash} = location;
const newQuery = safeQuery(parse(search.substr(1), {strictNullHandling: true}));
const newState = changeParams({...state, locationType}, {
query: {...defaultParams, ...newQuery}
});
return {...newState, pathname, hash, locationType};
};