Socket
Socket
Sign inDemoInstall

qs

Package Overview
Dependencies
0
Maintainers
3
Versions
110
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.5.1 to 6.5.2

5

CHANGELOG.md

@@ -0,1 +1,6 @@

## **6.5.2**
- [Fix] use `safer-buffer` instead of `Buffer` constructor
- [Refactor] utils: `module.exports` one thing, instead of mutating `exports` (#230)
- [Dev Deps] update `browserify`, `eslint`, `iconv-lite`, `safer-buffer`, `tape`, `browserify`
## **6.5.1**

@@ -2,0 +7,0 @@ - [Fix] Fix parsing & compacting very deep objects (#224)

37

dist/qs.js

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

(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){
(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(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
'use strict';

@@ -459,3 +459,3 @@

exports.arrayToObject = function arrayToObject(source, options) {
var arrayToObject = function arrayToObject(source, options) {
var obj = options && options.plainObjects ? Object.create(null) : {};

@@ -471,3 +471,3 @@ for (var i = 0; i < source.length; ++i) {

exports.merge = function merge(target, source, options) {
var merge = function merge(target, source, options) {
if (!source) {

@@ -497,3 +497,3 @@ return target;

if (Array.isArray(target) && !Array.isArray(source)) {
mergeTarget = exports.arrayToObject(target, options);
mergeTarget = arrayToObject(target, options);
}

@@ -505,3 +505,3 @@

if (target[i] && typeof target[i] === 'object') {
target[i] = exports.merge(target[i], item, options);
target[i] = merge(target[i], item, options);
} else {

@@ -521,3 +521,3 @@ target.push(item);

if (has.call(acc, key)) {
acc[key] = exports.merge(acc[key], value, options);
acc[key] = merge(acc[key], value, options);
} else {

@@ -530,3 +530,3 @@ acc[key] = value;

exports.assign = function assignSingleSource(target, source) {
var assign = function assignSingleSource(target, source) {
return Object.keys(source).reduce(function (acc, key) {

@@ -538,3 +538,3 @@ acc[key] = source[key];

exports.decode = function (str) {
var decode = function (str) {
try {

@@ -547,3 +547,3 @@ return decodeURIComponent(str.replace(/\+/g, ' '));

exports.encode = function encode(str) {
var encode = function encode(str) {
// This code was originally written by Brian White (mscdex) for the io.js core querystring library.

@@ -600,3 +600,3 @@ // It has been adapted here for stricter adherence to RFC 3986

exports.compact = function compact(value) {
var compact = function compact(value) {
var queue = [{ obj: { o: value }, prop: 'o' }];

@@ -623,7 +623,7 @@ var refs = [];

exports.isRegExp = function isRegExp(obj) {
var isRegExp = function isRegExp(obj) {
return Object.prototype.toString.call(obj) === '[object RegExp]';
};
exports.isBuffer = function isBuffer(obj) {
var isBuffer = function isBuffer(obj) {
if (obj === null || typeof obj === 'undefined') {

@@ -636,3 +636,14 @@ return false;

module.exports = {
arrayToObject: arrayToObject,
assign: assign,
compact: compact,
decode: decode,
encode: encode,
isBuffer: isBuffer,
isRegExp: isRegExp,
merge: merge
};
},{}]},{},[2])(2)
});
});

@@ -37,3 +37,3 @@ 'use strict';

exports.arrayToObject = function arrayToObject(source, options) {
var arrayToObject = function arrayToObject(source, options) {
var obj = options && options.plainObjects ? Object.create(null) : {};

@@ -49,3 +49,3 @@ for (var i = 0; i < source.length; ++i) {

exports.merge = function merge(target, source, options) {
var merge = function merge(target, source, options) {
if (!source) {

@@ -75,3 +75,3 @@ return target;

if (Array.isArray(target) && !Array.isArray(source)) {
mergeTarget = exports.arrayToObject(target, options);
mergeTarget = arrayToObject(target, options);
}

@@ -83,3 +83,3 @@

if (target[i] && typeof target[i] === 'object') {
target[i] = exports.merge(target[i], item, options);
target[i] = merge(target[i], item, options);
} else {

@@ -99,3 +99,3 @@ target.push(item);

if (has.call(acc, key)) {
acc[key] = exports.merge(acc[key], value, options);
acc[key] = merge(acc[key], value, options);
} else {

@@ -108,3 +108,3 @@ acc[key] = value;

exports.assign = function assignSingleSource(target, source) {
var assign = function assignSingleSource(target, source) {
return Object.keys(source).reduce(function (acc, key) {

@@ -116,3 +116,3 @@ acc[key] = source[key];

exports.decode = function (str) {
var decode = function (str) {
try {

@@ -125,3 +125,3 @@ return decodeURIComponent(str.replace(/\+/g, ' '));

exports.encode = function encode(str) {
var encode = function encode(str) {
// This code was originally written by Brian White (mscdex) for the io.js core querystring library.

@@ -178,3 +178,3 @@ // It has been adapted here for stricter adherence to RFC 3986

exports.compact = function compact(value) {
var compact = function compact(value) {
var queue = [{ obj: { o: value }, prop: 'o' }];

@@ -201,7 +201,7 @@ var refs = [];

exports.isRegExp = function isRegExp(obj) {
var isRegExp = function isRegExp(obj) {
return Object.prototype.toString.call(obj) === '[object RegExp]';
};
exports.isBuffer = function isBuffer(obj) {
var isBuffer = function isBuffer(obj) {
if (obj === null || typeof obj === 'undefined') {

@@ -213,1 +213,12 @@ return false;

};
module.exports = {
arrayToObject: arrayToObject,
assign: assign,
compact: compact,
decode: decode,
encode: encode,
isBuffer: isBuffer,
isRegExp: isRegExp,
merge: merge
};

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

"homepage": "https://github.com/ljharb/qs",
"version": "6.5.1",
"version": "6.5.2",
"repository": {

@@ -29,12 +29,13 @@ "type": "git",

"@ljharb/eslint-config": "^12.2.1",
"browserify": "^14.4.0",
"browserify": "^16.2.0",
"covert": "^1.1.0",
"editorconfig-tools": "^0.1.1",
"eslint": "^4.6.1",
"eslint": "^4.19.1",
"evalmd": "^0.0.17",
"iconv-lite": "^0.4.18",
"iconv-lite": "^0.4.21",
"mkdirp": "^0.5.1",
"qs-iconv": "^1.0.4",
"safe-publish-latest": "^1.1.1",
"tape": "^4.8.0"
"safer-buffer": "^2.1.2",
"tape": "^4.9.0"
},

@@ -41,0 +42,0 @@ "scripts": {

@@ -7,2 +7,3 @@ 'use strict';

var iconv = require('iconv-lite');
var SaferBuffer = require('safer-buffer').Buffer;

@@ -235,3 +236,3 @@ test('parse()', function (t) {

t.test('parses buffers correctly', function (st) {
var b = new Buffer('test');
var b = SaferBuffer.from('test');
st.deepEqual(qs.parse({ a: b }), { a: b });

@@ -544,3 +545,3 @@ st.end();

}
return iconv.decode(new Buffer(result), 'shift_jis').toString();
return iconv.decode(SaferBuffer.from(result), 'shift_jis').toString();
}

@@ -547,0 +548,0 @@ }), { 県: '大阪府' });

@@ -7,2 +7,3 @@ 'use strict';

var iconv = require('iconv-lite');
var SaferBuffer = require('safer-buffer').Buffer;

@@ -340,4 +341,4 @@ test('stringify()', function (t) {

t.test('stringifies buffer values', function (st) {
st.equal(qs.stringify({ a: new Buffer('test') }), 'a=test');
st.equal(qs.stringify({ a: { b: new Buffer('test') } }), 'a%5Bb%5D=test');
st.equal(qs.stringify({ a: SaferBuffer.from('test') }), 'a=test');
st.equal(qs.stringify({ a: { b: SaferBuffer.from('test') } }), 'a%5Bb%5D=test');
st.end();

@@ -486,3 +487,3 @@ });

t.test('can use custom encoder for a buffer object', { skip: typeof Buffer === 'undefined' }, function (st) {
st.equal(qs.stringify({ a: new Buffer([1]) }, {
st.equal(qs.stringify({ a: SaferBuffer.from([1]) }, {
encoder: function (buffer) {

@@ -489,0 +490,0 @@ if (typeof buffer === 'string') {

Sorry, the diff of this file is not supported yet

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