🔧 npm update
This commit is contained in:
96
node_modules/qs/lib/utils.js
generated
vendored
96
node_modules/qs/lib/utils.js
generated
vendored
@@ -34,7 +34,7 @@ var compactQueue = function compactQueue(queue) {
|
||||
};
|
||||
|
||||
var arrayToObject = function arrayToObject(source, options) {
|
||||
var obj = options && options.plainObjects ? Object.create(null) : {};
|
||||
var obj = options && options.plainObjects ? { __proto__: null } : {};
|
||||
for (var i = 0; i < source.length; ++i) {
|
||||
if (typeof source[i] !== 'undefined') {
|
||||
obj[i] = source[i];
|
||||
@@ -50,11 +50,14 @@ var merge = function merge(target, source, options) {
|
||||
return target;
|
||||
}
|
||||
|
||||
if (typeof source !== 'object') {
|
||||
if (typeof source !== 'object' && typeof source !== 'function') {
|
||||
if (isArray(target)) {
|
||||
target.push(source);
|
||||
} else if (target && typeof target === 'object') {
|
||||
if ((options && (options.plainObjects || options.allowPrototypes)) || !has.call(Object.prototype, source)) {
|
||||
if (
|
||||
(options && (options.plainObjects || options.allowPrototypes))
|
||||
|| !has.call(Object.prototype, source)
|
||||
) {
|
||||
target[source] = true;
|
||||
}
|
||||
} else {
|
||||
@@ -108,7 +111,7 @@ var assign = function assignSingleSource(target, source) {
|
||||
}, target);
|
||||
};
|
||||
|
||||
var decode = function (str, decoder, charset) {
|
||||
var decode = function (str, defaultDecoder, charset) {
|
||||
var strWithoutPlus = str.replace(/\+/g, ' ');
|
||||
if (charset === 'iso-8859-1') {
|
||||
// unescape never throws, no try...catch needed:
|
||||
@@ -122,6 +125,10 @@ var decode = function (str, decoder, charset) {
|
||||
}
|
||||
};
|
||||
|
||||
var limit = 1024;
|
||||
|
||||
/* eslint operator-linebreak: [2, "before"] */
|
||||
|
||||
var encode = function encode(str, defaultEncoder, charset, kind, format) {
|
||||
// This code was originally written by Brian White (mscdex) for the io.js core querystring library.
|
||||
// It has been adapted here for stricter adherence to RFC 3986
|
||||
@@ -143,45 +150,54 @@ var encode = function encode(str, defaultEncoder, charset, kind, format) {
|
||||
}
|
||||
|
||||
var out = '';
|
||||
for (var i = 0; i < string.length; ++i) {
|
||||
var c = string.charCodeAt(i);
|
||||
for (var j = 0; j < string.length; j += limit) {
|
||||
var segment = string.length >= limit ? string.slice(j, j + limit) : string;
|
||||
var arr = [];
|
||||
|
||||
if (
|
||||
c === 0x2D // -
|
||||
|| c === 0x2E // .
|
||||
|| c === 0x5F // _
|
||||
|| c === 0x7E // ~
|
||||
|| (c >= 0x30 && c <= 0x39) // 0-9
|
||||
|| (c >= 0x41 && c <= 0x5A) // a-z
|
||||
|| (c >= 0x61 && c <= 0x7A) // A-Z
|
||||
|| (format === formats.RFC1738 && (c === 0x28 || c === 0x29)) // ( )
|
||||
) {
|
||||
out += string.charAt(i);
|
||||
continue;
|
||||
for (var i = 0; i < segment.length; ++i) {
|
||||
var c = segment.charCodeAt(i);
|
||||
if (
|
||||
c === 0x2D // -
|
||||
|| c === 0x2E // .
|
||||
|| c === 0x5F // _
|
||||
|| c === 0x7E // ~
|
||||
|| (c >= 0x30 && c <= 0x39) // 0-9
|
||||
|| (c >= 0x41 && c <= 0x5A) // a-z
|
||||
|| (c >= 0x61 && c <= 0x7A) // A-Z
|
||||
|| (format === formats.RFC1738 && (c === 0x28 || c === 0x29)) // ( )
|
||||
) {
|
||||
arr[arr.length] = segment.charAt(i);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c < 0x80) {
|
||||
arr[arr.length] = hexTable[c];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c < 0x800) {
|
||||
arr[arr.length] = hexTable[0xC0 | (c >> 6)]
|
||||
+ hexTable[0x80 | (c & 0x3F)];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c < 0xD800 || c >= 0xE000) {
|
||||
arr[arr.length] = hexTable[0xE0 | (c >> 12)]
|
||||
+ hexTable[0x80 | ((c >> 6) & 0x3F)]
|
||||
+ hexTable[0x80 | (c & 0x3F)];
|
||||
continue;
|
||||
}
|
||||
|
||||
i += 1;
|
||||
c = 0x10000 + (((c & 0x3FF) << 10) | (segment.charCodeAt(i) & 0x3FF));
|
||||
|
||||
arr[arr.length] = hexTable[0xF0 | (c >> 18)]
|
||||
+ hexTable[0x80 | ((c >> 12) & 0x3F)]
|
||||
+ hexTable[0x80 | ((c >> 6) & 0x3F)]
|
||||
+ hexTable[0x80 | (c & 0x3F)];
|
||||
}
|
||||
|
||||
if (c < 0x80) {
|
||||
out = out + hexTable[c];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c < 0x800) {
|
||||
out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c < 0xD800 || c >= 0xE000) {
|
||||
out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);
|
||||
continue;
|
||||
}
|
||||
|
||||
i += 1;
|
||||
c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
|
||||
/* eslint operator-linebreak: [2, "before"] */
|
||||
out += hexTable[0xF0 | (c >> 18)]
|
||||
+ hexTable[0x80 | ((c >> 12) & 0x3F)]
|
||||
+ hexTable[0x80 | ((c >> 6) & 0x3F)]
|
||||
+ hexTable[0x80 | (c & 0x3F)];
|
||||
out += arr.join('');
|
||||
}
|
||||
|
||||
return out;
|
||||
|
||||
Reference in New Issue
Block a user