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

qs

Package Overview
Dependencies
Maintainers
3
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

qs - npm Package Compare versions

Comparing version 6.0.3 to 6.0.4

1

bower.json
{
"name": "qs",
"main": "dist/qs.js",
"version": "5.2.0",
"homepage": "https://github.com/hapijs/qs",

@@ -6,0 +5,0 @@ "authors": [

6

CHANGELOG.md

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

## **6.0.4**
- [Fix] follow `allowPrototypes` option during merge (#201, #200)
- [Fix] chmod a-x
- [Fix] support keys starting with brackets (#202, #200)
- [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds
## **6.0.3**

@@ -2,0 +8,0 @@ - [Fix] ensure that `allowPrototypes: false` does not ever shadow Object.prototype properties

@@ -5,3 +5,3 @@ {

"description": "query-string parser / stringifier with nesting support",
"version": "6.0.3",
"version": "6.0.4",
"keywords": ["querystring", "query", "parser"],

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

@@ -28,2 +28,4 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Qs = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

var has = Object.prototype.hasOwnProperty;
internals.parseValues = function (str, options) {

@@ -47,3 +49,3 @@ var obj = {};

if (Object.prototype.hasOwnProperty.call(obj, key)) {
if (has.call(obj, key)) {
obj[key] = [].concat(obj[key]).concat(val);

@@ -101,3 +103,3 @@ } else {

var parent = /^([^[]*)/;
var brackets = /(\[[^[\]]*])/;
var child = /(\[[^[\]]*])/g;

@@ -107,3 +109,4 @@

var segment = parent.exec(key);
var segment = brackets.exec(key);
var parent = segment ? key.slice(0, segment.index) : key;

@@ -113,6 +116,6 @@ // Stash the parent if it exists

var keys = [];
if (segment[1]) {
if (parent) {
// If we aren't using plain objects, optionally prefix keys
// that would overwrite object prototype properties
if (!options.plainObjects && Object.prototype.hasOwnProperty(segment[1])) {
if (!options.plainObjects && has.call(Object.prototype, parent)) {
if (!options.allowPrototypes) {

@@ -123,3 +126,3 @@ return;

keys.push(segment[1]);
keys.push(parent);
}

@@ -132,3 +135,3 @@

i += 1;
if (!options.plainObjects && Object.prototype.hasOwnProperty.call(Object.prototype, segment[1].slice(1, -1))) {
if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
if (!options.allowPrototypes) {

@@ -329,2 +332,4 @@ return;

var has = Object.prototype.hasOwnProperty;
exports.arrayToObject = function (source, options) {

@@ -350,3 +355,5 @@ var obj = options.plainObjects ? Object.create(null) : {};

} else if (typeof target === 'object') {
target[source] = true;
if (options.plainObjects || options.allowPrototypes || !has.call(Object.prototype, source)) {
target[source] = true;
}
} else {

@@ -371,3 +378,3 @@ return [target, source];

if (Object.prototype.hasOwnProperty.call(acc, key)) {
if (has.call(acc, key)) {
acc[key] = exports.merge(acc[key], value, options);

@@ -374,0 +381,0 @@ } else {

@@ -16,2 +16,4 @@ 'use strict';

var has = Object.prototype.hasOwnProperty;
internals.parseValues = function (str, options) {

@@ -35,3 +37,3 @@ var obj = {};

if (Object.prototype.hasOwnProperty.call(obj, key)) {
if (has.call(obj, key)) {
obj[key] = [].concat(obj[key]).concat(val);

@@ -89,3 +91,3 @@ } else {

var parent = /^([^[]*)/;
var brackets = /(\[[^[\]]*])/;
var child = /(\[[^[\]]*])/g;

@@ -95,3 +97,4 @@

var segment = parent.exec(key);
var segment = brackets.exec(key);
var parent = segment ? key.slice(0, segment.index) : key;

@@ -101,6 +104,6 @@ // Stash the parent if it exists

var keys = [];
if (segment[1]) {
if (parent) {
// If we aren't using plain objects, optionally prefix keys
// that would overwrite object prototype properties
if (!options.plainObjects && Object.prototype.hasOwnProperty(segment[1])) {
if (!options.plainObjects && has.call(Object.prototype, parent)) {
if (!options.allowPrototypes) {

@@ -111,3 +114,3 @@ return;

keys.push(segment[1]);
keys.push(parent);
}

@@ -120,3 +123,3 @@

i += 1;
if (!options.plainObjects && Object.prototype.hasOwnProperty.call(Object.prototype, segment[1].slice(1, -1))) {
if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
if (!options.allowPrototypes) {

@@ -123,0 +126,0 @@ return;

@@ -12,2 +12,4 @@ 'use strict';

var has = Object.prototype.hasOwnProperty;
exports.arrayToObject = function (source, options) {

@@ -33,3 +35,5 @@ var obj = options.plainObjects ? Object.create(null) : {};

} else if (typeof target === 'object') {
target[source] = true;
if (options.plainObjects || options.allowPrototypes || !has.call(Object.prototype, source)) {
target[source] = true;
}
} else {

@@ -54,3 +58,3 @@ return [target, source];

if (Object.prototype.hasOwnProperty.call(acc, key)) {
if (has.call(acc, key)) {
acc[key] = exports.merge(acc[key], value, options);

@@ -57,0 +61,0 @@ } else {

@@ -5,3 +5,3 @@ {

"homepage": "https://github.com/ljharb/qs",
"version": "6.0.3",
"version": "6.0.4",
"repository": {

@@ -38,3 +38,4 @@ "type": "git",

"scripts": {
"test": "parallelshell 'npm run readme' 'npm run lint' 'npm run coverage'",
"pretest": "npm run lint && npm run readme",
"test": "npm run coverage",
"tests-only": "node test",

@@ -41,0 +42,0 @@ "readme": "evalmd README.md",

@@ -145,4 +145,2 @@ 'use strict';

t.deepEqual(qs.parse('a[b]=c&a=d'), { a: { b: 'c', d: true } }, 'can add keys to objects');
t.test('correctly prunes undefined values when converting an array to an object', function (st) {

@@ -405,6 +403,43 @@ st.deepEqual(qs.parse('a[2]=b&a[99999999]=c'), { a: { '2': 'b', '99999999': 'c' } });

st.deepEqual(qs.parse(']=toString'), { ']': 'toString' });
st.deepEqual(qs.parse(']]=toString'), { ']]': 'toString' });
st.deepEqual(qs.parse(']hello]=toString'), { ']hello]': 'toString' });
st.end();
});
t.test('can return plain objects', function (st) {
t.test('params starting with a starting bracket', function (st) {
st.deepEqual(qs.parse('[=toString'), { '[': 'toString' });
st.deepEqual(qs.parse('[[=toString'), { '[[': 'toString' });
st.deepEqual(qs.parse('[hello[=toString'), { '[hello[': 'toString' });
st.end();
});
t.test('add keys to objects', function (st) {
st.deepEqual(
qs.parse('a[b]=c&a=d'),
{ a: { b: 'c', d: true } },
'can add keys to objects'
);
st.deepEqual(
qs.parse('a[b]=c&a=toString'),
{ a: { b: 'c' } },
'can not overwrite prototype'
);
st.deepEqual(
qs.parse('a[b]=c&a=toString', { allowPrototypes: true }),
{ a: { b: 'c', toString: true } },
'can overwrite prototype with allowPrototypes true'
);
st.deepEqual(
qs.parse('a[b]=c&a=toString', { plainObjects: true }),
{ a: { b: 'c', toString: true } },
'can overwrite prototype with plainObjects true'
);
st.end();
});
t.test('can return null objects', { skip: !Object.create }, function (st) {
var expected = Object.create(null);

@@ -411,0 +446,0 @@ expected.a = Object.create(null);

Sorry, the diff of this file is not supported yet

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