Socket
Socket
Sign inDemoInstall

serialize-query-params

Package Overview
Dependencies
5
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.3 to 1.3.4

LICENSE

17

esm/index.js

@@ -7,18 +7,1 @@ export { withDefault } from './withDefault';

export { decodeQueryParams } from './decodeQueryParams';
if (process.env.NODE_ENV !== 'production' && typeof require === 'function') {
/*
* run checks to ensure a valid version of query-string is installed
* see https://github.com/pbeshai/use-query-params/issues/127 for discussion
*/
var queryStringVersion = require('query-string/package.json').version;
// simple check of versions since we don't anticipate any new minor v5s and
// don't want to require the semver package as a dependency for just a simple
// dev check.
var validQueryStringInstalled = /^5.1.[1-9][0-9]*/.test(queryStringVersion) ||
/^6\./.test(queryStringVersion) || /^7\./.test(queryStringVersion);
if (!validQueryStringInstalled) {
throw new Error("serialize-query-params requires query-string ^5.1.1 || ^6, " +
("but " + queryStringVersion + " is installed. Note: you may also ") +
"see this message if you're using use-query-params.");
}
}

12

esm/serialize.js

@@ -1,7 +0,5 @@

var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};

@@ -82,3 +80,3 @@ /**

}
var decoded = new (Date.bind.apply(Date, __spreadArrays([void 0], parts)))();
var decoded = new (Date.bind.apply(Date, __spreadArray([void 0], parts)))();
if (isNaN(decoded.getTime())) {

@@ -85,0 +83,0 @@ return null;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.decodeQueryParams = exports.encodeQueryParams = exports.transformSearchStringJsonSafe = exports.updateInLocation = exports.updateLocation = exports.createEnumParam = exports.DelimitedNumericArrayParam = exports.DelimitedArrayParam = exports.NumericObjectParam = exports.BooleanParam = exports.DateTimeParam = exports.DateParam = exports.JsonParam = exports.NumericArrayParam = exports.ArrayParam = exports.ObjectParam = exports.NumberParam = exports.StringParam = exports.decodeNumericObject = exports.encodeNumericObject = exports.decodeObject = exports.encodeObject = exports.decodeDelimitedNumericArray = exports.encodeDelimitedNumericArray = exports.decodeDelimitedArray = exports.encodeDelimitedArray = exports.decodeNumericArray = exports.encodeNumericArray = exports.decodeArray = exports.encodeArray = exports.decodeJson = exports.encodeJson = exports.decodeEnum = exports.decodeString = exports.encodeString = exports.decodeNumber = exports.encodeNumber = exports.decodeBoolean = exports.encodeBoolean = exports.decodeDate = exports.encodeDate = exports.withDefault = void 0;
var withDefault_1 = require("./withDefault");

@@ -51,18 +52,1 @@ Object.defineProperty(exports, "withDefault", { enumerable: true, get: function () { return withDefault_1.withDefault; } });

Object.defineProperty(exports, "decodeQueryParams", { enumerable: true, get: function () { return decodeQueryParams_1.decodeQueryParams; } });
if (process.env.NODE_ENV !== 'production' && typeof require === 'function') {
/*
* run checks to ensure a valid version of query-string is installed
* see https://github.com/pbeshai/use-query-params/issues/127 for discussion
*/
var queryStringVersion = require('query-string/package.json').version;
// simple check of versions since we don't anticipate any new minor v5s and
// don't want to require the semver package as a dependency for just a simple
// dev check.
var validQueryStringInstalled = /^5.1.[1-9][0-9]*/.test(queryStringVersion) ||
/^6\./.test(queryStringVersion) || /^7\./.test(queryStringVersion);
if (!validQueryStringInstalled) {
throw new Error("serialize-query-params requires query-string ^5.1.1 || ^6, " +
("but " + queryStringVersion + " is installed. Note: you may also ") +
"see this message if you're using use-query-params.");
}
}

@@ -15,6 +15,7 @@ "use strict";

*/
exports.createEnumParam = function (enumValues) { return ({
var createEnumParam = function (enumValues) { return ({
encode: Serialize.encodeString,
decode: function (input) { return Serialize.decodeEnum(input, enumValues); },
}); };
exports.createEnumParam = createEnumParam;
/**

@@ -21,0 +22,0 @@ * Numbers (integers or floats)

"use strict";
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};

@@ -86,3 +84,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

}
var decoded = new (Date.bind.apply(Date, __spreadArrays([void 0], parts)))();
var decoded = new (Date.bind.apply(Date, __spreadArray([void 0], parts)))();
if (isNaN(decoded.getTime())) {

@@ -89,0 +87,0 @@ return null;

{
"name": "serialize-query-params",
"version": "1.3.3",
"version": "1.3.4",
"description": "A library for simplifying encoding and decoding URL query parameters.",

@@ -26,3 +26,3 @@ "main": "lib/index.js",

"type": "git",
"url": "https://github.com/pbeshai/serialize-query-params.git"
"url": "https://github.com/pbeshai/use-query-params.git"
},

@@ -43,16 +43,8 @@ "keywords": [

"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/preset-env": "^7.9.5",
"@babel/preset-typescript": "^7.9.0",
"@types/jest": "^24.0.11",
"@types/node": "12.7.4",
"babel-jest": "^25.3.0",
"jest": "^25.3.0",
"query-string": "^6.12.1",
"rimraf": "^3.0.2",
"typescript": "^3.8.3"
"@types/node": "15.0.1"
},
"peerDependencies": {
"query-string": "^5.1.1 || ^6 || ^7"
}
"query-string": "^7"
},
"gitHead": "a188792eb35c63feff0920746798bcd3910fd1dd"
}

@@ -14,3 +14,3 @@ <div align="center">

<a href="#api">API</a> |
<a href="https://peterbeshai.com/use-query-params/">useQueryParams</a>
<a href="https://pbeshai.github.io/use-query-params/">useQueryParams</a>

@@ -20,3 +20,3 @@ </div>

Used in React with [use-query-params](https://github.com/pbeshai/use-query-params).
Used in React with [use-query-params](../use-query-params).

@@ -40,4 +40,4 @@ ### Installation

- [updateLocationIn](#usequeryparams-1)
- [Type Definitions](https://github.com/pbeshai/serialize-query-params/blob/master/src/types.ts)
- [Serialization Utility Functions](https://github.com/pbeshai/serialize-query-params/blob/master/src/serialize.ts)
- [Type Definitions](./src/types.ts)
- [Serialization Utility Functions](./src/serialize.ts)

@@ -48,3 +48,3 @@

#### Param Types
See [all param definitions here](https://github.com/pbeshai/serialize-query-params/blob/master/src/params.ts). You can define your own parameter types by creating an object with an `encode` and a `decode` function. See the existing definitions for examples.
See [all param definitions here](./src/params.ts). You can define your own parameter types by creating an object with an `encode` and a `decode` function. See the existing definitions for examples.

@@ -102,3 +102,3 @@ Note that all null and empty values are typically treated as follows:

You can define your own params if the ones shipped with this package don't work for you. There are included [serialization utility functions](https://github.com/pbeshai/serialize-query-params/blob/master/src/serialize.ts) to make this easier, but you can use whatever you like.
You can define your own params if the ones shipped with this package don't work for you. There are included [serialization utility functions](./src/serialize.ts) to make this easier, but you can use whatever you like.

@@ -105,0 +105,0 @@ ```js

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc