Update npm dependencies
Update npm dependencies 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
58
node_modules/qs/lib/utils.js
generated
vendored
58
node_modules/qs/lib/utils.js
generated
vendored
@@ -1,10 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
var formats = require('./formats');
|
||||
var getSideChannel = require('side-channel');
|
||||
|
||||
var has = Object.prototype.hasOwnProperty;
|
||||
var isArray = Array.isArray;
|
||||
|
||||
// Track objects created from arrayLimit overflow using side-channel
|
||||
// Stores the current max numeric index for O(1) lookup
|
||||
var overflowChannel = getSideChannel();
|
||||
|
||||
var markOverflow = function markOverflow(obj, maxIndex) {
|
||||
overflowChannel.set(obj, maxIndex);
|
||||
return obj;
|
||||
};
|
||||
|
||||
var isOverflow = function isOverflow(obj) {
|
||||
return overflowChannel.has(obj);
|
||||
};
|
||||
|
||||
var getMaxIndex = function getMaxIndex(obj) {
|
||||
return overflowChannel.get(obj);
|
||||
};
|
||||
|
||||
var setMaxIndex = function setMaxIndex(obj, maxIndex) {
|
||||
overflowChannel.set(obj, maxIndex);
|
||||
};
|
||||
|
||||
var hexTable = (function () {
|
||||
var array = [];
|
||||
for (var i = 0; i < 256; ++i) {
|
||||
@@ -54,7 +76,12 @@ var merge = function merge(target, source, options) {
|
||||
if (isArray(target)) {
|
||||
target.push(source);
|
||||
} else if (target && typeof target === 'object') {
|
||||
if (
|
||||
if (isOverflow(target)) {
|
||||
// Add at next numeric index for overflow objects
|
||||
var newIndex = getMaxIndex(target) + 1;
|
||||
target[newIndex] = source;
|
||||
setMaxIndex(target, newIndex);
|
||||
} else if (
|
||||
(options && (options.plainObjects || options.allowPrototypes))
|
||||
|| !has.call(Object.prototype, source)
|
||||
) {
|
||||
@@ -68,6 +95,18 @@ var merge = function merge(target, source, options) {
|
||||
}
|
||||
|
||||
if (!target || typeof target !== 'object') {
|
||||
if (isOverflow(source)) {
|
||||
// Create new object with target at 0, source values shifted by 1
|
||||
var sourceKeys = Object.keys(source);
|
||||
var result = options && options.plainObjects
|
||||
? { __proto__: null, 0: target }
|
||||
: { 0: target };
|
||||
for (var m = 0; m < sourceKeys.length; m++) {
|
||||
var oldKey = parseInt(sourceKeys[m], 10);
|
||||
result[oldKey + 1] = source[sourceKeys[m]];
|
||||
}
|
||||
return markOverflow(result, getMaxIndex(source) + 1);
|
||||
}
|
||||
return [target].concat(source);
|
||||
}
|
||||
|
||||
@@ -239,8 +278,20 @@ var isBuffer = function isBuffer(obj) {
|
||||
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
|
||||
};
|
||||
|
||||
var combine = function combine(a, b) {
|
||||
return [].concat(a, b);
|
||||
var combine = function combine(a, b, arrayLimit, plainObjects) {
|
||||
// If 'a' is already an overflow object, add to it
|
||||
if (isOverflow(a)) {
|
||||
var newIndex = getMaxIndex(a) + 1;
|
||||
a[newIndex] = b;
|
||||
setMaxIndex(a, newIndex);
|
||||
return a;
|
||||
}
|
||||
|
||||
var result = [].concat(a, b);
|
||||
if (result.length > arrayLimit) {
|
||||
return markOverflow(arrayToObject(result, { plainObjects: plainObjects }), result.length - 1);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
var maybeMap = function maybeMap(val, fn) {
|
||||
@@ -262,6 +313,7 @@ module.exports = {
|
||||
decode: decode,
|
||||
encode: encode,
|
||||
isBuffer: isBuffer,
|
||||
isOverflow: isOverflow,
|
||||
isRegExp: isRegExp,
|
||||
maybeMap: maybeMap,
|
||||
merge: merge
|
||||
|
||||
Reference in New Issue
Block a user