mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
Use query-string instead of qs
Saves bytes, as done by rackt/history: https://github.com/rackt/history/issues/121
This commit is contained in:
parent
c3f05861cc
commit
af9d9132d2
@ -2,7 +2,7 @@
|
||||
|
||||
import camelCase from 'camelcase';
|
||||
import decamelize from 'decamelize';
|
||||
import qs from 'qs';
|
||||
import queryString from 'query-string';
|
||||
|
||||
import { sanitize } from './general_utils';
|
||||
|
||||
@ -36,8 +36,7 @@ export function argsToQueryParams(obj) {
|
||||
queryParamObj[decamelize(key)] = sanitizedObj[key];
|
||||
});
|
||||
|
||||
// Use bracket arrayFormat as history.js and react-router use it
|
||||
return '?' + qs.stringify(queryParamObj, { arrayFormat: 'brackets' });
|
||||
return '?' + queryString.stringify(queryParamObj);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -56,13 +55,13 @@ export function getCurrentQueryParams() {
|
||||
* @return {object} Query params dictionary
|
||||
*/
|
||||
export function queryParamsToArgs(queryParamString) {
|
||||
const qsQueryParamObj = qs.parse(queryParamString);
|
||||
const queryParamObj = queryString.parse(queryParamString);
|
||||
const camelCaseParamObj = {};
|
||||
|
||||
Object
|
||||
.keys(qsQueryParamObj)
|
||||
.keys(queryParamObj)
|
||||
.forEach((key) => {
|
||||
camelCaseParamObj[camelCase(key)] = qsQueryParamObj[key];
|
||||
camelCaseParamObj[camelCase(key)] = queryParamObj[key];
|
||||
});
|
||||
|
||||
return camelCaseParamObj;
|
||||
|
@ -75,7 +75,7 @@
|
||||
"object-assign": "^2.0.0",
|
||||
"opn": "^3.0.2",
|
||||
"q": "^1.4.1",
|
||||
"qs": "^4.0.0",
|
||||
"query-string": "^3.0.0",
|
||||
"raven-js": "^1.1.19",
|
||||
"react": "0.13.2",
|
||||
"react-bootstrap": "0.25.1",
|
||||
|
Loading…
Reference in New Issue
Block a user