Socket
Socket
Sign inDemoInstall

react-router-query-params

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-router-query-params - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

41

es/index.js

@@ -15,3 +15,3 @@ import _defineProperty from 'babel-runtime/helpers/defineProperty';

import { isObject, assert } from './utils';
import { assert } from './utils';

@@ -56,3 +56,15 @@ export default function withQueryParams() {

return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref2 = WithQueryParams.__proto__ || _Object$getPrototypeOf(WithQueryParams)).call.apply(_ref2, [this].concat(args))), _this), _initialiseProps.call(_this), _temp), _possibleConstructorReturn(_this, _ret);
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref2 = WithQueryParams.__proto__ || _Object$getPrototypeOf(WithQueryParams)).call.apply(_ref2, [this].concat(args))), _this), _this.setQueryParams = function (obj) {
var _this$props = _this.props,
location = _this$props.location,
history = _this$props.history;
var to = history.createHref({
pathname: location.pathname,
search: queryString.stringify(_extends({}, queryString.parse(location.search, QUERYPARAMS_OPTIONS), obj), QUERYPARAMS_OPTIONS)
});
history.push(to);
}, _temp), _possibleConstructorReturn(_this, _ret);
}

@@ -86,3 +98,3 @@

location: location,
setQueryParam: this.setQueryParam,
setQueryParams: this.setQueryParams,
queryParams: allParams

@@ -110,28 +122,5 @@ };

var _initialiseProps = function _initialiseProps() {
var _this3 = this;
this.setQueryParam = function () {
var obj = isObject(arguments.length <= 0 ? undefined : arguments[0]) ? arguments.length <= 0 ? undefined : arguments[0] : _defineProperty({}, arguments.length <= 0 ? undefined : arguments[0], arguments.length <= 1 ? undefined : arguments[1]);
_this3.setQueryParams(obj);
};
this.setQueryParams = function (obj) {
var _props = _this3.props,
location = _props.location,
history = _props.history;
var to = history.createHref({
pathname: location.pathname,
search: queryString.stringify(_extends({}, queryString.parse(location.search, QUERYPARAMS_OPTIONS), obj), QUERYPARAMS_OPTIONS)
});
history.push(to);
};
};
return withRouter(WithQueryParams);
};
}

@@ -1,4 +0,2 @@

export var isObject = function isObject(value) {
return Object.prototype.toString.call(value) === '[object Object]';
};
/* eslint-disable import/prefer-default-export */

@@ -5,0 +3,0 @@ export var assert = function assert(condition) {

@@ -101,3 +101,15 @@ 'use strict';

return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref2 = WithQueryParams.__proto__ || (0, _getPrototypeOf2.default)(WithQueryParams)).call.apply(_ref2, [this].concat(args))), _this), _initialiseProps.call(_this), _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref2 = WithQueryParams.__proto__ || (0, _getPrototypeOf2.default)(WithQueryParams)).call.apply(_ref2, [this].concat(args))), _this), _this.setQueryParams = function (obj) {
var _this$props = _this.props,
location = _this$props.location,
history = _this$props.history;
var to = history.createHref({
pathname: location.pathname,
search: _queryString2.default.stringify((0, _extends4.default)({}, _queryString2.default.parse(location.search, QUERYPARAMS_OPTIONS), obj), QUERYPARAMS_OPTIONS)
});
history.push(to);
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}

@@ -131,3 +143,3 @@

location: location,
setQueryParam: this.setQueryParam,
setQueryParams: this.setQueryParams,
queryParams: allParams

@@ -154,28 +166,5 @@ };

var _initialiseProps = function _initialiseProps() {
var _this3 = this;
this.setQueryParam = function () {
var obj = (0, _utils.isObject)(arguments.length <= 0 ? undefined : arguments[0]) ? arguments.length <= 0 ? undefined : arguments[0] : (0, _defineProperty3.default)({}, arguments.length <= 0 ? undefined : arguments[0], arguments.length <= 1 ? undefined : arguments[1]);
_this3.setQueryParams(obj);
};
this.setQueryParams = function (obj) {
var _props = _this3.props,
location = _props.location,
history = _props.history;
var to = history.createHref({
pathname: location.pathname,
search: _queryString2.default.stringify((0, _extends4.default)({}, _queryString2.default.parse(location.search, QUERYPARAMS_OPTIONS), obj), QUERYPARAMS_OPTIONS)
});
history.push(to);
};
};
return (0, _reactRouterDom.withRouter)(WithQueryParams);
};
}

@@ -6,5 +6,3 @@ 'use strict';

});
var isObject = exports.isObject = function isObject(value) {
return Object.prototype.toString.call(value) === '[object Object]';
};
/* eslint-disable import/prefer-default-export */

@@ -11,0 +9,0 @@ var assert = exports.assert = function assert(condition) {

{
"name": "react-router-query-params",
"version": "1.0.0",
"version": "1.0.1",
"description": "Set query parameters with a schema for react-router.",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -7,6 +7,3 @@ import React, { PureComponent } from 'react';

import {
isObject,
assert,
} from './utils';
import { assert } from './utils';

@@ -54,10 +51,2 @@ export default function withQueryParams({

setQueryParam = (...args) => {
const obj = isObject(args[0]) ? args[0] : {
[args[0]]: args[1],
};
this.setQueryParams(obj);
}
setQueryParams = (obj) => {

@@ -113,3 +102,3 @@ const {

location,
setQueryParam: this.setQueryParam,
setQueryParams: this.setQueryParams,
queryParams: allParams,

@@ -116,0 +105,0 @@ };

@@ -1,2 +0,2 @@

export const isObject = value => Object.prototype.toString.call(value) === '[object Object]';
/* eslint-disable import/prefer-default-export */

@@ -3,0 +3,0 @@ export const assert = (condition, message = 'Assertion failed') => {

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