Update npm packages (73 packages including @jqhtml 2.3.36)
Update npm registry domain from privatenpm.hanson.xyz to npm.internal.hanson.xyz 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2
node_modules/axios/lib/adapters/README.md
generated
vendored
2
node_modules/axios/lib/adapters/README.md
generated
vendored
@@ -5,7 +5,7 @@ The modules under `adapters/` are modules that handle dispatching a request and
|
||||
## Example
|
||||
|
||||
```js
|
||||
var settle = require('./../core/settle');
|
||||
var settle = require('../core/settle');
|
||||
|
||||
module.exports = function myAdapter(config) {
|
||||
// At this point:
|
||||
|
||||
4
node_modules/axios/lib/adapters/fetch.js
generated
vendored
4
node_modules/axios/lib/adapters/fetch.js
generated
vendored
@@ -247,14 +247,14 @@ const factory = (env) => {
|
||||
|
||||
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
||||
throw Object.assign(
|
||||
new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
|
||||
new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, err && err.response),
|
||||
{
|
||||
cause: err.cause || err
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
throw AxiosError.from(err, err && err.code, config, request);
|
||||
throw AxiosError.from(err, err && err.code, config, request, err && err.response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
23
node_modules/axios/lib/adapters/http.js
generated
vendored
23
node_modules/axios/lib/adapters/http.js
generated
vendored
@@ -1,7 +1,7 @@
|
||||
import utils from './../utils.js';
|
||||
import settle from './../core/settle.js';
|
||||
import utils from '../utils.js';
|
||||
import settle from '../core/settle.js';
|
||||
import buildFullPath from '../core/buildFullPath.js';
|
||||
import buildURL from './../helpers/buildURL.js';
|
||||
import buildURL from '../helpers/buildURL.js';
|
||||
import proxyFromEnv from 'proxy-from-env';
|
||||
import http from 'http';
|
||||
import https from 'https';
|
||||
@@ -193,12 +193,16 @@ function setProxy(options, configProxy, location) {
|
||||
|
||||
if (proxy.auth) {
|
||||
// Support proxy auth object form
|
||||
if (proxy.auth.username || proxy.auth.password) {
|
||||
const validProxyAuth = Boolean(proxy.auth.username || proxy.auth.password);
|
||||
|
||||
if (validProxyAuth) {
|
||||
proxy.auth = (proxy.auth.username || '') + ':' + (proxy.auth.password || '');
|
||||
} else if (typeof proxy.auth === 'object') {
|
||||
throw new AxiosError('Invalid proxy authorization', AxiosError.ERR_BAD_OPTION, { proxy });
|
||||
}
|
||||
const base64 = Buffer
|
||||
.from(proxy.auth, 'utf8')
|
||||
.toString('base64');
|
||||
|
||||
const base64 = Buffer.from(proxy.auth, 'utf8').toString('base64');
|
||||
|
||||
options.headers['Proxy-Authorization'] = 'Basic ' + base64;
|
||||
}
|
||||
|
||||
@@ -264,7 +268,8 @@ const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(addr
|
||||
|
||||
const http2Transport = {
|
||||
request(options, cb) {
|
||||
const authority = options.protocol + '//' + options.hostname + ':' + (options.port || 80);
|
||||
const authority = options.protocol + '//' + options.hostname + ':' + (options.port ||(options.protocol === 'https:' ? 443 : 80));
|
||||
|
||||
|
||||
const {http2Options, headers} = options;
|
||||
|
||||
@@ -812,8 +817,6 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
||||
|
||||
// Handle errors
|
||||
req.on('error', function handleRequestError(err) {
|
||||
// @todo remove
|
||||
// if (req.aborted && err.code !== AxiosError.ERR_FR_TOO_MANY_REDIRECTS) return;
|
||||
reject(AxiosError.from(err, null, config, req));
|
||||
});
|
||||
|
||||
|
||||
4
node_modules/axios/lib/adapters/xhr.js
generated
vendored
4
node_modules/axios/lib/adapters/xhr.js
generated
vendored
@@ -1,5 +1,5 @@
|
||||
import utils from './../utils.js';
|
||||
import settle from './../core/settle.js';
|
||||
import utils from '../utils.js';
|
||||
import settle from '../core/settle.js';
|
||||
import transitionalDefaults from '../defaults/transitional.js';
|
||||
import AxiosError from '../core/AxiosError.js';
|
||||
import CanceledError from '../cancel/CanceledError.js';
|
||||
|
||||
33
node_modules/axios/lib/cancel/CanceledError.js
generated
vendored
33
node_modules/axios/lib/cancel/CanceledError.js
generated
vendored
@@ -1,25 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
import AxiosError from '../core/AxiosError.js';
|
||||
import utils from '../utils.js';
|
||||
|
||||
/**
|
||||
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
||||
*
|
||||
* @param {string=} message The message.
|
||||
* @param {Object=} config The config.
|
||||
* @param {Object=} request The request.
|
||||
*
|
||||
* @returns {CanceledError} The created error.
|
||||
*/
|
||||
function CanceledError(message, config, request) {
|
||||
// eslint-disable-next-line no-eq-null,eqeqeq
|
||||
AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
|
||||
this.name = 'CanceledError';
|
||||
class CanceledError extends AxiosError {
|
||||
/**
|
||||
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
||||
*
|
||||
* @param {string=} message The message.
|
||||
* @param {Object=} config The config.
|
||||
* @param {Object=} request The request.
|
||||
*
|
||||
* @returns {CanceledError} The created error.
|
||||
*/
|
||||
constructor(message, config, request) {
|
||||
super(message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
|
||||
this.name = 'CanceledError';
|
||||
this.__CANCEL__ = true;
|
||||
}
|
||||
}
|
||||
|
||||
utils.inherits(CanceledError, AxiosError, {
|
||||
__CANCEL__: true
|
||||
});
|
||||
|
||||
export default CanceledError;
|
||||
|
||||
15
node_modules/axios/lib/core/Axios.js
generated
vendored
15
node_modules/axios/lib/core/Axios.js
generated
vendored
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import utils from './../utils.js';
|
||||
import utils from '../utils.js';
|
||||
import buildURL from '../helpers/buildURL.js';
|
||||
import InterceptorManager from './InterceptorManager.js';
|
||||
import dispatchRequest from './dispatchRequest.js';
|
||||
@@ -8,6 +8,7 @@ import mergeConfig from './mergeConfig.js';
|
||||
import buildFullPath from './buildFullPath.js';
|
||||
import validator from '../helpers/validator.js';
|
||||
import AxiosHeaders from './AxiosHeaders.js';
|
||||
import transitionalDefaults from '../defaults/transitional.js';
|
||||
|
||||
const validators = validator.validators;
|
||||
|
||||
@@ -80,7 +81,8 @@ class Axios {
|
||||
validator.assertOptions(transitional, {
|
||||
silentJSONParsing: validators.transitional(validators.boolean),
|
||||
forcedJSONParsing: validators.transitional(validators.boolean),
|
||||
clarifyTimeoutError: validators.transitional(validators.boolean)
|
||||
clarifyTimeoutError: validators.transitional(validators.boolean),
|
||||
legacyInterceptorReqResOrdering: validators.transitional(validators.boolean)
|
||||
}, false);
|
||||
}
|
||||
|
||||
@@ -139,7 +141,14 @@ class Axios {
|
||||
|
||||
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
||||
|
||||
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
||||
const transitional = config.transitional || transitionalDefaults;
|
||||
const legacyInterceptorReqResOrdering = transitional && transitional.legacyInterceptorReqResOrdering;
|
||||
|
||||
if (legacyInterceptorReqResOrdering) {
|
||||
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
||||
} else {
|
||||
requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
||||
}
|
||||
});
|
||||
|
||||
const responseInterceptorChain = [];
|
||||
|
||||
163
node_modules/axios/lib/core/AxiosError.js
generated
vendored
163
node_modules/axios/lib/core/AxiosError.js
generated
vendored
@@ -2,109 +2,72 @@
|
||||
|
||||
import utils from '../utils.js';
|
||||
|
||||
/**
|
||||
* Create an Error with the specified message, config, error code, request and response.
|
||||
*
|
||||
* @param {string} message The error message.
|
||||
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
||||
* @param {Object} [config] The config.
|
||||
* @param {Object} [request] The request.
|
||||
* @param {Object} [response] The response.
|
||||
*
|
||||
* @returns {Error} The created error.
|
||||
*/
|
||||
function AxiosError(message, code, config, request, response) {
|
||||
Error.call(this);
|
||||
class AxiosError extends Error {
|
||||
static from(error, code, config, request, response, customProps) {
|
||||
const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
|
||||
axiosError.cause = error;
|
||||
axiosError.name = error.name;
|
||||
customProps && Object.assign(axiosError, customProps);
|
||||
return axiosError;
|
||||
}
|
||||
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
} else {
|
||||
this.stack = (new Error()).stack;
|
||||
}
|
||||
/**
|
||||
* Create an Error with the specified message, config, error code, request and response.
|
||||
*
|
||||
* @param {string} message The error message.
|
||||
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
||||
* @param {Object} [config] The config.
|
||||
* @param {Object} [request] The request.
|
||||
* @param {Object} [response] The response.
|
||||
*
|
||||
* @returns {Error} The created error.
|
||||
*/
|
||||
constructor(message, code, config, request, response) {
|
||||
super(message);
|
||||
this.name = 'AxiosError';
|
||||
this.isAxiosError = true;
|
||||
code && (this.code = code);
|
||||
config && (this.config = config);
|
||||
request && (this.request = request);
|
||||
if (response) {
|
||||
this.response = response;
|
||||
this.status = response.status;
|
||||
}
|
||||
}
|
||||
|
||||
this.message = message;
|
||||
this.name = 'AxiosError';
|
||||
code && (this.code = code);
|
||||
config && (this.config = config);
|
||||
request && (this.request = request);
|
||||
if (response) {
|
||||
this.response = response;
|
||||
this.status = response.status ? response.status : null;
|
||||
}
|
||||
toJSON() {
|
||||
return {
|
||||
// Standard
|
||||
message: this.message,
|
||||
name: this.name,
|
||||
// Microsoft
|
||||
description: this.description,
|
||||
number: this.number,
|
||||
// Mozilla
|
||||
fileName: this.fileName,
|
||||
lineNumber: this.lineNumber,
|
||||
columnNumber: this.columnNumber,
|
||||
stack: this.stack,
|
||||
// Axios
|
||||
config: utils.toJSONObject(this.config),
|
||||
code: this.code,
|
||||
status: this.status,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
utils.inherits(AxiosError, Error, {
|
||||
toJSON: function toJSON() {
|
||||
return {
|
||||
// Standard
|
||||
message: this.message,
|
||||
name: this.name,
|
||||
// Microsoft
|
||||
description: this.description,
|
||||
number: this.number,
|
||||
// Mozilla
|
||||
fileName: this.fileName,
|
||||
lineNumber: this.lineNumber,
|
||||
columnNumber: this.columnNumber,
|
||||
stack: this.stack,
|
||||
// Axios
|
||||
config: utils.toJSONObject(this.config),
|
||||
code: this.code,
|
||||
status: this.status
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
const prototype = AxiosError.prototype;
|
||||
const descriptors = {};
|
||||
|
||||
[
|
||||
'ERR_BAD_OPTION_VALUE',
|
||||
'ERR_BAD_OPTION',
|
||||
'ECONNABORTED',
|
||||
'ETIMEDOUT',
|
||||
'ERR_NETWORK',
|
||||
'ERR_FR_TOO_MANY_REDIRECTS',
|
||||
'ERR_DEPRECATED',
|
||||
'ERR_BAD_RESPONSE',
|
||||
'ERR_BAD_REQUEST',
|
||||
'ERR_CANCELED',
|
||||
'ERR_NOT_SUPPORT',
|
||||
'ERR_INVALID_URL'
|
||||
// eslint-disable-next-line func-names
|
||||
].forEach(code => {
|
||||
descriptors[code] = {value: code};
|
||||
});
|
||||
|
||||
Object.defineProperties(AxiosError, descriptors);
|
||||
Object.defineProperty(prototype, 'isAxiosError', {value: true});
|
||||
|
||||
// eslint-disable-next-line func-names
|
||||
AxiosError.from = (error, code, config, request, response, customProps) => {
|
||||
const axiosError = Object.create(prototype);
|
||||
|
||||
utils.toFlatObject(error, axiosError, function filter(obj) {
|
||||
return obj !== Error.prototype;
|
||||
}, prop => {
|
||||
return prop !== 'isAxiosError';
|
||||
});
|
||||
|
||||
const msg = error && error.message ? error.message : 'Error';
|
||||
|
||||
// Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
|
||||
const errCode = code == null && error ? error.code : code;
|
||||
AxiosError.call(axiosError, msg, errCode, config, request, response);
|
||||
|
||||
// Chain the original error on the standard field; non-enumerable to avoid JSON noise
|
||||
if (error && axiosError.cause == null) {
|
||||
Object.defineProperty(axiosError, 'cause', { value: error, configurable: true });
|
||||
}
|
||||
|
||||
axiosError.name = (error && error.name) || 'Error';
|
||||
|
||||
customProps && Object.assign(axiosError, customProps);
|
||||
|
||||
return axiosError;
|
||||
};
|
||||
// This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
|
||||
AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
|
||||
AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
|
||||
AxiosError.ECONNABORTED = 'ECONNABORTED';
|
||||
AxiosError.ETIMEDOUT = 'ETIMEDOUT';
|
||||
AxiosError.ERR_NETWORK = 'ERR_NETWORK';
|
||||
AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
|
||||
AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
|
||||
AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
|
||||
AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
|
||||
AxiosError.ERR_CANCELED = 'ERR_CANCELED';
|
||||
AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
|
||||
AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
|
||||
|
||||
export default AxiosError;
|
||||
|
||||
3
node_modules/axios/lib/core/InterceptorManager.js
generated
vendored
3
node_modules/axios/lib/core/InterceptorManager.js
generated
vendored
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import utils from './../utils.js';
|
||||
import utils from '../utils.js';
|
||||
|
||||
class InterceptorManager {
|
||||
constructor() {
|
||||
@@ -12,6 +12,7 @@ class InterceptorManager {
|
||||
*
|
||||
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
||||
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
||||
* @param {Object} options The options for the interceptor, synchronous and runWhen
|
||||
*
|
||||
* @return {Number} An ID used to remove interceptor later
|
||||
*/
|
||||
|
||||
35
node_modules/axios/lib/core/mergeConfig.js
generated
vendored
35
node_modules/axios/lib/core/mergeConfig.js
generated
vendored
@@ -1,9 +1,10 @@
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
import utils from '../utils.js';
|
||||
import utils from "../utils.js";
|
||||
import AxiosHeaders from "./AxiosHeaders.js";
|
||||
|
||||
const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;
|
||||
const headersToObject = (thing) =>
|
||||
thing instanceof AxiosHeaders ? { ...thing } : thing;
|
||||
|
||||
/**
|
||||
* Config-specific merge-function which creates a new config-object
|
||||
@@ -21,7 +22,7 @@ export default function mergeConfig(config1, config2) {
|
||||
|
||||
function getMergedValue(target, source, prop, caseless) {
|
||||
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
||||
return utils.merge.call({caseless}, target, source);
|
||||
return utils.merge.call({ caseless }, target, source);
|
||||
} else if (utils.isPlainObject(source)) {
|
||||
return utils.merge({}, source);
|
||||
} else if (utils.isArray(source)) {
|
||||
@@ -30,7 +31,6 @@ export default function mergeConfig(config1, config2) {
|
||||
return source;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line consistent-return
|
||||
function mergeDeepProperties(a, b, prop, caseless) {
|
||||
if (!utils.isUndefined(b)) {
|
||||
return getMergedValue(a, b, prop, caseless);
|
||||
@@ -93,14 +93,27 @@ export default function mergeConfig(config1, config2) {
|
||||
socketPath: defaultToConfig2,
|
||||
responseEncoding: defaultToConfig2,
|
||||
validateStatus: mergeDirectKeys,
|
||||
headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
|
||||
headers: (a, b, prop) =>
|
||||
mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
|
||||
};
|
||||
|
||||
utils.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
|
||||
const merge = mergeMap[prop] || mergeDeepProperties;
|
||||
const configValue = merge(config1[prop], config2[prop], prop);
|
||||
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
||||
});
|
||||
utils.forEach(
|
||||
Object.keys({ ...config1, ...config2 }),
|
||||
function computeConfigValue(prop) {
|
||||
if (
|
||||
prop === "__proto__" ||
|
||||
prop === "constructor" ||
|
||||
prop === "prototype"
|
||||
)
|
||||
return;
|
||||
const merge = utils.hasOwnProp(mergeMap, prop)
|
||||
? mergeMap[prop]
|
||||
: mergeDeepProperties;
|
||||
const configValue = merge(config1[prop], config2[prop], prop);
|
||||
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) ||
|
||||
(config[prop] = configValue);
|
||||
},
|
||||
);
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
2
node_modules/axios/lib/core/transformData.js
generated
vendored
2
node_modules/axios/lib/core/transformData.js
generated
vendored
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import utils from './../utils.js';
|
||||
import utils from '../utils.js';
|
||||
import defaults from '../defaults/index.js';
|
||||
import AxiosHeaders from '../core/AxiosHeaders.js';
|
||||
|
||||
|
||||
3
node_modules/axios/lib/defaults/transitional.js
generated
vendored
3
node_modules/axios/lib/defaults/transitional.js
generated
vendored
@@ -3,5 +3,6 @@
|
||||
export default {
|
||||
silentJSONParsing: true,
|
||||
forcedJSONParsing: true,
|
||||
clarifyTimeoutError: false
|
||||
clarifyTimeoutError: false,
|
||||
legacyInterceptorReqResOrdering: true
|
||||
};
|
||||
|
||||
2
node_modules/axios/lib/env/data.js
generated
vendored
2
node_modules/axios/lib/env/data.js
generated
vendored
@@ -1 +1 @@
|
||||
export const VERSION = "1.13.2";
|
||||
export const VERSION = "1.13.5";
|
||||
17
node_modules/axios/lib/helpers/buildURL.js
generated
vendored
17
node_modules/axios/lib/helpers/buildURL.js
generated
vendored
@@ -29,29 +29,26 @@ function encode(val) {
|
||||
* @returns {string} The formatted url
|
||||
*/
|
||||
export default function buildURL(url, params, options) {
|
||||
/*eslint no-param-reassign:0*/
|
||||
if (!params) {
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
const _encode = options && options.encode || encode;
|
||||
|
||||
if (utils.isFunction(options)) {
|
||||
options = {
|
||||
serialize: options
|
||||
};
|
||||
}
|
||||
const _options = utils.isFunction(options) ? {
|
||||
serialize: options
|
||||
} : options;
|
||||
|
||||
const serializeFn = options && options.serialize;
|
||||
const serializeFn = _options && _options.serialize;
|
||||
|
||||
let serializedParams;
|
||||
|
||||
if (serializeFn) {
|
||||
serializedParams = serializeFn(params, options);
|
||||
serializedParams = serializeFn(params, _options);
|
||||
} else {
|
||||
serializedParams = utils.isURLSearchParams(params) ?
|
||||
params.toString() :
|
||||
new AxiosURLSearchParams(params, options).toString(_encode);
|
||||
new AxiosURLSearchParams(params, _options).toString(_encode);
|
||||
}
|
||||
|
||||
if (serializedParams) {
|
||||
|
||||
2
node_modules/axios/lib/helpers/composeSignals.js
generated
vendored
2
node_modules/axios/lib/helpers/composeSignals.js
generated
vendored
@@ -21,7 +21,7 @@ const composeSignals = (signals, timeout) => {
|
||||
|
||||
let timer = timeout && setTimeout(() => {
|
||||
timer = null;
|
||||
onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT))
|
||||
onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT))
|
||||
}, timeout)
|
||||
|
||||
const unsubscribe = () => {
|
||||
|
||||
2
node_modules/axios/lib/helpers/cookies.js
generated
vendored
2
node_modules/axios/lib/helpers/cookies.js
generated
vendored
@@ -1,4 +1,4 @@
|
||||
import utils from './../utils.js';
|
||||
import utils from '../utils.js';
|
||||
import platform from '../platform/index.js';
|
||||
|
||||
export default platform.hasStandardBrowserEnv ?
|
||||
|
||||
5
node_modules/axios/lib/helpers/isAbsoluteURL.js
generated
vendored
5
node_modules/axios/lib/helpers/isAbsoluteURL.js
generated
vendored
@@ -11,5 +11,10 @@ export default function isAbsoluteURL(url) {
|
||||
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
||||
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
||||
// by any combination of letters, digits, plus, period, or hyphen.
|
||||
if (typeof url !== 'string') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
||||
}
|
||||
|
||||
|
||||
2
node_modules/axios/lib/helpers/isAxiosError.js
generated
vendored
2
node_modules/axios/lib/helpers/isAxiosError.js
generated
vendored
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import utils from './../utils.js';
|
||||
import utils from '../utils.js';
|
||||
|
||||
/**
|
||||
* Determines whether the payload is an error thrown by Axios
|
||||
|
||||
2
node_modules/axios/lib/helpers/parseHeaders.js
generated
vendored
2
node_modules/axios/lib/helpers/parseHeaders.js
generated
vendored
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import utils from './../utils.js';
|
||||
import utils from '../utils.js';
|
||||
|
||||
// RawAxiosHeaders whose duplicates are ignored by node
|
||||
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
||||
|
||||
2
node_modules/axios/lib/helpers/spread.js
generated
vendored
2
node_modules/axios/lib/helpers/spread.js
generated
vendored
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* ```js
|
||||
* function f(x, y, z) {}
|
||||
* var args = [1, 2, 3];
|
||||
* const args = [1, 2, 3];
|
||||
* f.apply(null, args);
|
||||
* ```
|
||||
*
|
||||
|
||||
357
node_modules/axios/lib/utils.js
generated
vendored
357
node_modules/axios/lib/utils.js
generated
vendored
@@ -1,33 +1,33 @@
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
import bind from './helpers/bind.js';
|
||||
import bind from "./helpers/bind.js";
|
||||
|
||||
// utils is a library of generic helper functions non-specific to axios
|
||||
|
||||
const {toString} = Object.prototype;
|
||||
const {getPrototypeOf} = Object;
|
||||
const {iterator, toStringTag} = Symbol;
|
||||
const { toString } = Object.prototype;
|
||||
const { getPrototypeOf } = Object;
|
||||
const { iterator, toStringTag } = Symbol;
|
||||
|
||||
const kindOf = (cache => thing => {
|
||||
const str = toString.call(thing);
|
||||
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
||||
const kindOf = ((cache) => (thing) => {
|
||||
const str = toString.call(thing);
|
||||
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
||||
})(Object.create(null));
|
||||
|
||||
const kindOfTest = (type) => {
|
||||
type = type.toLowerCase();
|
||||
return (thing) => kindOf(thing) === type
|
||||
}
|
||||
return (thing) => kindOf(thing) === type;
|
||||
};
|
||||
|
||||
const typeOfTest = type => thing => typeof thing === type;
|
||||
const typeOfTest = (type) => (thing) => typeof thing === type;
|
||||
|
||||
/**
|
||||
* Determine if a value is an Array
|
||||
* Determine if a value is a non-null object
|
||||
*
|
||||
* @param {Object} val The value to test
|
||||
*
|
||||
* @returns {boolean} True if value is an Array, otherwise false
|
||||
*/
|
||||
const {isArray} = Array;
|
||||
const { isArray } = Array;
|
||||
|
||||
/**
|
||||
* Determine if a value is undefined
|
||||
@@ -36,7 +36,7 @@ const {isArray} = Array;
|
||||
*
|
||||
* @returns {boolean} True if the value is undefined, otherwise false
|
||||
*/
|
||||
const isUndefined = typeOfTest('undefined');
|
||||
const isUndefined = typeOfTest("undefined");
|
||||
|
||||
/**
|
||||
* Determine if a value is a Buffer
|
||||
@@ -46,8 +46,14 @@ const isUndefined = typeOfTest('undefined');
|
||||
* @returns {boolean} True if value is a Buffer, otherwise false
|
||||
*/
|
||||
function isBuffer(val) {
|
||||
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
|
||||
&& isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
||||
return (
|
||||
val !== null &&
|
||||
!isUndefined(val) &&
|
||||
val.constructor !== null &&
|
||||
!isUndefined(val.constructor) &&
|
||||
isFunction(val.constructor.isBuffer) &&
|
||||
val.constructor.isBuffer(val)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,8 +63,7 @@ function isBuffer(val) {
|
||||
*
|
||||
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
||||
*/
|
||||
const isArrayBuffer = kindOfTest('ArrayBuffer');
|
||||
|
||||
const isArrayBuffer = kindOfTest("ArrayBuffer");
|
||||
|
||||
/**
|
||||
* Determine if a value is a view on an ArrayBuffer
|
||||
@@ -69,10 +74,10 @@ const isArrayBuffer = kindOfTest('ArrayBuffer');
|
||||
*/
|
||||
function isArrayBufferView(val) {
|
||||
let result;
|
||||
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
||||
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
|
||||
result = ArrayBuffer.isView(val);
|
||||
} else {
|
||||
result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
|
||||
result = val && val.buffer && isArrayBuffer(val.buffer);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -84,7 +89,7 @@ function isArrayBufferView(val) {
|
||||
*
|
||||
* @returns {boolean} True if value is a String, otherwise false
|
||||
*/
|
||||
const isString = typeOfTest('string');
|
||||
const isString = typeOfTest("string");
|
||||
|
||||
/**
|
||||
* Determine if a value is a Function
|
||||
@@ -92,7 +97,7 @@ const isString = typeOfTest('string');
|
||||
* @param {*} val The value to test
|
||||
* @returns {boolean} True if value is a Function, otherwise false
|
||||
*/
|
||||
const isFunction = typeOfTest('function');
|
||||
const isFunction = typeOfTest("function");
|
||||
|
||||
/**
|
||||
* Determine if a value is a Number
|
||||
@@ -101,7 +106,7 @@ const isFunction = typeOfTest('function');
|
||||
*
|
||||
* @returns {boolean} True if value is a Number, otherwise false
|
||||
*/
|
||||
const isNumber = typeOfTest('number');
|
||||
const isNumber = typeOfTest("number");
|
||||
|
||||
/**
|
||||
* Determine if a value is an Object
|
||||
@@ -110,7 +115,7 @@ const isNumber = typeOfTest('number');
|
||||
*
|
||||
* @returns {boolean} True if value is an Object, otherwise false
|
||||
*/
|
||||
const isObject = (thing) => thing !== null && typeof thing === 'object';
|
||||
const isObject = (thing) => thing !== null && typeof thing === "object";
|
||||
|
||||
/**
|
||||
* Determine if a value is a Boolean
|
||||
@@ -118,7 +123,7 @@ const isObject = (thing) => thing !== null && typeof thing === 'object';
|
||||
* @param {*} thing The value to test
|
||||
* @returns {boolean} True if value is a Boolean, otherwise false
|
||||
*/
|
||||
const isBoolean = thing => thing === true || thing === false;
|
||||
const isBoolean = (thing) => thing === true || thing === false;
|
||||
|
||||
/**
|
||||
* Determine if a value is a plain Object
|
||||
@@ -128,13 +133,19 @@ const isBoolean = thing => thing === true || thing === false;
|
||||
* @returns {boolean} True if value is a plain Object, otherwise false
|
||||
*/
|
||||
const isPlainObject = (val) => {
|
||||
if (kindOf(val) !== 'object') {
|
||||
if (kindOf(val) !== "object") {
|
||||
return false;
|
||||
}
|
||||
|
||||
const prototype = getPrototypeOf(val);
|
||||
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
|
||||
}
|
||||
return (
|
||||
(prototype === null ||
|
||||
prototype === Object.prototype ||
|
||||
Object.getPrototypeOf(prototype) === null) &&
|
||||
!(toStringTag in val) &&
|
||||
!(iterator in val)
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Determine if a value is an empty object (safely handles Buffers)
|
||||
@@ -150,12 +161,15 @@ const isEmptyObject = (val) => {
|
||||
}
|
||||
|
||||
try {
|
||||
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
||||
return (
|
||||
Object.keys(val).length === 0 &&
|
||||
Object.getPrototypeOf(val) === Object.prototype
|
||||
);
|
||||
} catch (e) {
|
||||
// Fallback for any other objects that might cause RangeError with Object.keys()
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Determine if a value is a Date
|
||||
@@ -164,7 +178,7 @@ const isEmptyObject = (val) => {
|
||||
*
|
||||
* @returns {boolean} True if value is a Date, otherwise false
|
||||
*/
|
||||
const isDate = kindOfTest('Date');
|
||||
const isDate = kindOfTest("Date");
|
||||
|
||||
/**
|
||||
* Determine if a value is a File
|
||||
@@ -173,7 +187,7 @@ const isDate = kindOfTest('Date');
|
||||
*
|
||||
* @returns {boolean} True if value is a File, otherwise false
|
||||
*/
|
||||
const isFile = kindOfTest('File');
|
||||
const isFile = kindOfTest("File");
|
||||
|
||||
/**
|
||||
* Determine if a value is a Blob
|
||||
@@ -182,7 +196,7 @@ const isFile = kindOfTest('File');
|
||||
*
|
||||
* @returns {boolean} True if value is a Blob, otherwise false
|
||||
*/
|
||||
const isBlob = kindOfTest('Blob');
|
||||
const isBlob = kindOfTest("Blob");
|
||||
|
||||
/**
|
||||
* Determine if a value is a FileList
|
||||
@@ -191,7 +205,7 @@ const isBlob = kindOfTest('Blob');
|
||||
*
|
||||
* @returns {boolean} True if value is a File, otherwise false
|
||||
*/
|
||||
const isFileList = kindOfTest('FileList');
|
||||
const isFileList = kindOfTest("FileList");
|
||||
|
||||
/**
|
||||
* Determine if a value is a Stream
|
||||
@@ -211,16 +225,17 @@ const isStream = (val) => isObject(val) && isFunction(val.pipe);
|
||||
*/
|
||||
const isFormData = (thing) => {
|
||||
let kind;
|
||||
return thing && (
|
||||
(typeof FormData === 'function' && thing instanceof FormData) || (
|
||||
isFunction(thing.append) && (
|
||||
(kind = kindOf(thing)) === 'formdata' ||
|
||||
// detect form-data instance
|
||||
(kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
return (
|
||||
thing &&
|
||||
((typeof FormData === "function" && thing instanceof FormData) ||
|
||||
(isFunction(thing.append) &&
|
||||
((kind = kindOf(thing)) === "formdata" ||
|
||||
// detect form-data instance
|
||||
(kind === "object" &&
|
||||
isFunction(thing.toString) &&
|
||||
thing.toString() === "[object FormData]"))))
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Determine if a value is a URLSearchParams object
|
||||
@@ -229,9 +244,14 @@ const isFormData = (thing) => {
|
||||
*
|
||||
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
||||
*/
|
||||
const isURLSearchParams = kindOfTest('URLSearchParams');
|
||||
const isURLSearchParams = kindOfTest("URLSearchParams");
|
||||
|
||||
const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
|
||||
const [isReadableStream, isRequest, isResponse, isHeaders] = [
|
||||
"ReadableStream",
|
||||
"Request",
|
||||
"Response",
|
||||
"Headers",
|
||||
].map(kindOfTest);
|
||||
|
||||
/**
|
||||
* Trim excess whitespace off the beginning and end of a string
|
||||
@@ -240,8 +260,8 @@ const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream',
|
||||
*
|
||||
* @returns {String} The String freed of excess whitespace
|
||||
*/
|
||||
const trim = (str) => str.trim ?
|
||||
str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
||||
const trim = (str) =>
|
||||
str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
||||
|
||||
/**
|
||||
* Iterate over an Array or an Object invoking a function for each item.
|
||||
@@ -252,15 +272,16 @@ const trim = (str) => str.trim ?
|
||||
* If 'obj' is an Object callback will be called passing
|
||||
* the value, key, and complete object for each property.
|
||||
*
|
||||
* @param {Object|Array} obj The object to iterate
|
||||
* @param {Object|Array<unknown>} obj The object to iterate
|
||||
* @param {Function} fn The callback to invoke for each item
|
||||
*
|
||||
* @param {Boolean} [allOwnKeys = false]
|
||||
* @param {Object} [options]
|
||||
* @param {Boolean} [options.allOwnKeys = false]
|
||||
* @returns {any}
|
||||
*/
|
||||
function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
||||
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
||||
// Don't bother if no value provided
|
||||
if (obj === null || typeof obj === 'undefined') {
|
||||
if (obj === null || typeof obj === "undefined") {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -268,7 +289,7 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
||||
let l;
|
||||
|
||||
// Force an array if not already something iterable
|
||||
if (typeof obj !== 'object') {
|
||||
if (typeof obj !== "object") {
|
||||
/*eslint no-param-reassign:0*/
|
||||
obj = [obj];
|
||||
}
|
||||
@@ -285,7 +306,9 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
||||
}
|
||||
|
||||
// Iterate over object keys
|
||||
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
||||
const keys = allOwnKeys
|
||||
? Object.getOwnPropertyNames(obj)
|
||||
: Object.keys(obj);
|
||||
const len = keys.length;
|
||||
let key;
|
||||
|
||||
@@ -297,7 +320,7 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
||||
}
|
||||
|
||||
function findKey(obj, key) {
|
||||
if (isBuffer(obj)){
|
||||
if (isBuffer(obj)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -317,10 +340,15 @@ function findKey(obj, key) {
|
||||
const _global = (() => {
|
||||
/*eslint no-undef:0*/
|
||||
if (typeof globalThis !== "undefined") return globalThis;
|
||||
return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
|
||||
return typeof self !== "undefined"
|
||||
? self
|
||||
: typeof window !== "undefined"
|
||||
? window
|
||||
: global;
|
||||
})();
|
||||
|
||||
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
||||
const isContextDefined = (context) =>
|
||||
!isUndefined(context) && context !== _global;
|
||||
|
||||
/**
|
||||
* Accepts varargs expecting each argument to be an object, then
|
||||
@@ -332,7 +360,7 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
|
||||
* Example:
|
||||
*
|
||||
* ```js
|
||||
* var result = merge({foo: 123}, {foo: 456});
|
||||
* const result = merge({foo: 123}, {foo: 456});
|
||||
* console.log(result.foo); // outputs 456
|
||||
* ```
|
||||
*
|
||||
@@ -341,10 +369,15 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
|
||||
* @returns {Object} Result of all merge properties
|
||||
*/
|
||||
function merge(/* obj1, obj2, obj3, ... */) {
|
||||
const {caseless, skipUndefined} = isContextDefined(this) && this || {};
|
||||
const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};
|
||||
const result = {};
|
||||
const assignValue = (val, key) => {
|
||||
const targetKey = caseless && findKey(result, key) || key;
|
||||
// Skip dangerous property names to prevent prototype pollution
|
||||
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
||||
return;
|
||||
}
|
||||
|
||||
const targetKey = (caseless && findKey(result, key)) || key;
|
||||
if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
|
||||
result[targetKey] = merge(result[targetKey], val);
|
||||
} else if (isPlainObject(val)) {
|
||||
@@ -354,7 +387,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
||||
} else if (!skipUndefined || !isUndefined(val)) {
|
||||
result[targetKey] = val;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
for (let i = 0, l = arguments.length; i < l; i++) {
|
||||
arguments[i] && forEach(arguments[i], assignValue);
|
||||
@@ -369,19 +402,34 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
||||
* @param {Object} b The object to copy properties from
|
||||
* @param {Object} thisArg The object to bind function to
|
||||
*
|
||||
* @param {Boolean} [allOwnKeys]
|
||||
* @param {Object} [options]
|
||||
* @param {Boolean} [options.allOwnKeys]
|
||||
* @returns {Object} The resulting value of object a
|
||||
*/
|
||||
const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
||||
forEach(b, (val, key) => {
|
||||
if (thisArg && isFunction(val)) {
|
||||
a[key] = bind(val, thisArg);
|
||||
} else {
|
||||
a[key] = val;
|
||||
}
|
||||
}, {allOwnKeys});
|
||||
const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
||||
forEach(
|
||||
b,
|
||||
(val, key) => {
|
||||
if (thisArg && isFunction(val)) {
|
||||
Object.defineProperty(a, key, {
|
||||
value: bind(val, thisArg),
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
});
|
||||
} else {
|
||||
Object.defineProperty(a, key, {
|
||||
value: val,
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
});
|
||||
}
|
||||
},
|
||||
{ allOwnKeys },
|
||||
);
|
||||
return a;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
|
||||
@@ -391,11 +439,11 @@ const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
||||
* @returns {string} content value without BOM
|
||||
*/
|
||||
const stripBOM = (content) => {
|
||||
if (content.charCodeAt(0) === 0xFEFF) {
|
||||
if (content.charCodeAt(0) === 0xfeff) {
|
||||
content = content.slice(1);
|
||||
}
|
||||
return content;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Inherit the prototype methods from one constructor into another
|
||||
@@ -407,13 +455,21 @@ const stripBOM = (content) => {
|
||||
* @returns {void}
|
||||
*/
|
||||
const inherits = (constructor, superConstructor, props, descriptors) => {
|
||||
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
||||
constructor.prototype.constructor = constructor;
|
||||
Object.defineProperty(constructor, 'super', {
|
||||
value: superConstructor.prototype
|
||||
constructor.prototype = Object.create(
|
||||
superConstructor.prototype,
|
||||
descriptors,
|
||||
);
|
||||
Object.defineProperty(constructor.prototype, "constructor", {
|
||||
value: constructor,
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
});
|
||||
Object.defineProperty(constructor, "super", {
|
||||
value: superConstructor.prototype,
|
||||
});
|
||||
props && Object.assign(constructor.prototype, props);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Resolve object with deep prototype chain to a flat object
|
||||
@@ -439,16 +495,23 @@ const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
|
||||
i = props.length;
|
||||
while (i-- > 0) {
|
||||
prop = props[i];
|
||||
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
|
||||
if (
|
||||
(!propFilter || propFilter(prop, sourceObj, destObj)) &&
|
||||
!merged[prop]
|
||||
) {
|
||||
destObj[prop] = sourceObj[prop];
|
||||
merged[prop] = true;
|
||||
}
|
||||
}
|
||||
sourceObj = filter !== false && getPrototypeOf(sourceObj);
|
||||
} while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
||||
} while (
|
||||
sourceObj &&
|
||||
(!filter || filter(sourceObj, destObj)) &&
|
||||
sourceObj !== Object.prototype
|
||||
);
|
||||
|
||||
return destObj;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Determines whether a string ends with the characters of a specified string
|
||||
@@ -467,8 +530,7 @@ const endsWith = (str, searchString, position) => {
|
||||
position -= searchString.length;
|
||||
const lastIndex = str.indexOf(searchString, position);
|
||||
return lastIndex !== -1 && lastIndex === position;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns new array from array like object or null if failed
|
||||
@@ -487,7 +549,7 @@ const toArray = (thing) => {
|
||||
arr[i] = thing[i];
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Checking if the Uint8Array exists and if it does, it returns a function that checks if the
|
||||
@@ -498,12 +560,12 @@ const toArray = (thing) => {
|
||||
* @returns {Array}
|
||||
*/
|
||||
// eslint-disable-next-line func-names
|
||||
const isTypedArray = (TypedArray => {
|
||||
const isTypedArray = ((TypedArray) => {
|
||||
// eslint-disable-next-line func-names
|
||||
return thing => {
|
||||
return (thing) => {
|
||||
return TypedArray && thing instanceof TypedArray;
|
||||
};
|
||||
})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
|
||||
})(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
|
||||
|
||||
/**
|
||||
* For each entry in the object, call the function with the key and value.
|
||||
@@ -524,7 +586,7 @@ const forEachEntry = (obj, fn) => {
|
||||
const pair = result.value;
|
||||
fn.call(obj, pair[0], pair[1]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* It takes a regular expression and a string, and returns an array of all the matches
|
||||
@@ -543,21 +605,25 @@ const matchAll = (regExp, str) => {
|
||||
}
|
||||
|
||||
return arr;
|
||||
}
|
||||
};
|
||||
|
||||
/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
|
||||
const isHTMLForm = kindOfTest('HTMLFormElement');
|
||||
const isHTMLForm = kindOfTest("HTMLFormElement");
|
||||
|
||||
const toCamelCase = str => {
|
||||
return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
|
||||
function replacer(m, p1, p2) {
|
||||
const toCamelCase = (str) => {
|
||||
return str
|
||||
.toLowerCase()
|
||||
.replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
|
||||
return p1.toUpperCase() + p2;
|
||||
}
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
/* Creating a function that will check if an object has a property. */
|
||||
const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
|
||||
const hasOwnProperty = (
|
||||
({ hasOwnProperty }) =>
|
||||
(obj, prop) =>
|
||||
hasOwnProperty.call(obj, prop)
|
||||
)(Object.prototype);
|
||||
|
||||
/**
|
||||
* Determine if a value is a RegExp object
|
||||
@@ -566,7 +632,7 @@ const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call
|
||||
*
|
||||
* @returns {boolean} True if value is a RegExp object, otherwise false
|
||||
*/
|
||||
const isRegExp = kindOfTest('RegExp');
|
||||
const isRegExp = kindOfTest("RegExp");
|
||||
|
||||
const reduceDescriptors = (obj, reducer) => {
|
||||
const descriptors = Object.getOwnPropertyDescriptors(obj);
|
||||
@@ -580,7 +646,7 @@ const reduceDescriptors = (obj, reducer) => {
|
||||
});
|
||||
|
||||
Object.defineProperties(obj, reducedDescriptors);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Makes all methods read-only
|
||||
@@ -590,7 +656,10 @@ const reduceDescriptors = (obj, reducer) => {
|
||||
const freezeMethods = (obj) => {
|
||||
reduceDescriptors(obj, (descriptor, name) => {
|
||||
// skip restricted props in strict mode
|
||||
if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
||||
if (
|
||||
isFunction(obj) &&
|
||||
["arguments", "caller", "callee"].indexOf(name) !== -1
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -600,40 +669,42 @@ const freezeMethods = (obj) => {
|
||||
|
||||
descriptor.enumerable = false;
|
||||
|
||||
if ('writable' in descriptor) {
|
||||
if ("writable" in descriptor) {
|
||||
descriptor.writable = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!descriptor.set) {
|
||||
descriptor.set = () => {
|
||||
throw Error('Can not rewrite read-only method \'' + name + '\'');
|
||||
throw Error("Can not rewrite read-only method '" + name + "'");
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const toObjectSet = (arrayOrString, delimiter) => {
|
||||
const obj = {};
|
||||
|
||||
const define = (arr) => {
|
||||
arr.forEach(value => {
|
||||
arr.forEach((value) => {
|
||||
obj[value] = true;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
|
||||
isArray(arrayOrString)
|
||||
? define(arrayOrString)
|
||||
: define(String(arrayOrString).split(delimiter));
|
||||
|
||||
return obj;
|
||||
}
|
||||
};
|
||||
|
||||
const noop = () => {}
|
||||
const noop = () => {};
|
||||
|
||||
const toFiniteNumber = (value, defaultValue) => {
|
||||
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
||||
}
|
||||
|
||||
|
||||
return value != null && Number.isFinite((value = +value))
|
||||
? value
|
||||
: defaultValue;
|
||||
};
|
||||
|
||||
/**
|
||||
* If the thing is a FormData object, return true, otherwise return false.
|
||||
@@ -643,14 +714,18 @@ const toFiniteNumber = (value, defaultValue) => {
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function isSpecCompliantForm(thing) {
|
||||
return !!(thing && isFunction(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
|
||||
return !!(
|
||||
thing &&
|
||||
isFunction(thing.append) &&
|
||||
thing[toStringTag] === "FormData" &&
|
||||
thing[iterator]
|
||||
);
|
||||
}
|
||||
|
||||
const toJSONObject = (obj) => {
|
||||
const stack = new Array(10);
|
||||
|
||||
const visit = (source, i) => {
|
||||
|
||||
if (isObject(source)) {
|
||||
if (stack.indexOf(source) >= 0) {
|
||||
return;
|
||||
@@ -661,7 +736,7 @@ const toJSONObject = (obj) => {
|
||||
return source;
|
||||
}
|
||||
|
||||
if(!('toJSON' in source)) {
|
||||
if (!("toJSON" in source)) {
|
||||
stack[i] = source;
|
||||
const target = isArray(source) ? [] : {};
|
||||
|
||||
@@ -677,15 +752,18 @@ const toJSONObject = (obj) => {
|
||||
}
|
||||
|
||||
return source;
|
||||
}
|
||||
};
|
||||
|
||||
return visit(obj, 0);
|
||||
}
|
||||
};
|
||||
|
||||
const isAsyncFn = kindOfTest('AsyncFunction');
|
||||
const isAsyncFn = kindOfTest("AsyncFunction");
|
||||
|
||||
const isThenable = (thing) =>
|
||||
thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
||||
thing &&
|
||||
(isObject(thing) || isFunction(thing)) &&
|
||||
isFunction(thing.then) &&
|
||||
isFunction(thing.catch);
|
||||
|
||||
// original code
|
||||
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
||||
@@ -695,32 +773,35 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
||||
return setImmediate;
|
||||
}
|
||||
|
||||
return postMessageSupported ? ((token, callbacks) => {
|
||||
_global.addEventListener("message", ({source, data}) => {
|
||||
if (source === _global && data === token) {
|
||||
callbacks.length && callbacks.shift()();
|
||||
}
|
||||
}, false);
|
||||
return postMessageSupported
|
||||
? ((token, callbacks) => {
|
||||
_global.addEventListener(
|
||||
"message",
|
||||
({ source, data }) => {
|
||||
if (source === _global && data === token) {
|
||||
callbacks.length && callbacks.shift()();
|
||||
}
|
||||
},
|
||||
false,
|
||||
);
|
||||
|
||||
return (cb) => {
|
||||
callbacks.push(cb);
|
||||
_global.postMessage(token, "*");
|
||||
}
|
||||
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
||||
})(
|
||||
typeof setImmediate === 'function',
|
||||
isFunction(_global.postMessage)
|
||||
);
|
||||
return (cb) => {
|
||||
callbacks.push(cb);
|
||||
_global.postMessage(token, "*");
|
||||
};
|
||||
})(`axios@${Math.random()}`, [])
|
||||
: (cb) => setTimeout(cb);
|
||||
})(typeof setImmediate === "function", isFunction(_global.postMessage));
|
||||
|
||||
const asap = typeof queueMicrotask !== 'undefined' ?
|
||||
queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate);
|
||||
const asap =
|
||||
typeof queueMicrotask !== "undefined"
|
||||
? queueMicrotask.bind(_global)
|
||||
: (typeof process !== "undefined" && process.nextTick) || _setImmediate;
|
||||
|
||||
// *********************
|
||||
|
||||
|
||||
const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
|
||||
|
||||
|
||||
export default {
|
||||
isArray,
|
||||
isArrayBuffer,
|
||||
@@ -778,5 +859,5 @@ export default {
|
||||
isThenable,
|
||||
setImmediate: _setImmediate,
|
||||
asap,
|
||||
isIterable
|
||||
isIterable,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user