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

g-string

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

g-string - npm Package Compare versions

Comparing version 0.1.0 to 1.0.0

test/return.js

28

index.js

@@ -1,22 +0,16 @@

const createHistory = require('history').createBrowserHistory;
const queryString = require('query-string');
const objectAssign = require('object-assign');
const history = createHistory();
function gString(obj, hash) {
const newHash = hash || location.hash;
const query = Object.assign({}, queryString.parse(location.search), obj);
const newQuery = queryString.stringify(query);
history.push(`${location.pathname}?${newQuery}`);
module.exports = function (obj, hash) {
let query = queryString.stringify(
objectAssign(
{},
queryString.parse(global.window.location.search),
obj
)
);
if (hash) {
location.hash = newHash;
query = query + '#' + hash || '';
}
}
module.exports = {
gString,
hListen: history.listen,
qParse: queryString.parse
return query;
};
{
"name": "g-string",
"version": "0.1.0",
"version": "1.0.0",
"description": "Manages query string",

@@ -12,3 +12,4 @@ "main": "index.js",

"query",
"string"
"string",
"url"
],

@@ -25,7 +26,16 @@ "author": {

"homepage": "https://github.com/gyfchong/g-string#readme",
"scripts": {
"test": "xo && ava"
},
"dependencies": {
"history": "^4.6.3",
"object-assign": "^4.1.1",
"query-string": "^5.0.0"
},
"devDependencies": {
"ava": "^0.22.0",
"xo": "^0.18.2"
},
"globals": {
"window": true
}
}
# g-string
> Manage your query string parameters
## Why?
Because React Router v4 doesn't manage query strings anymore, so I built my own :)
## Install

@@ -5,0 +8,0 @@

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