affiliations
This commit is contained in:
1 parent
4f3f9c9aad
commit
0b5b3dd3ee
177 files changed
+9660
-8531
No files matched your search
+185
-198
@@ -1,4 +1,4 @@
|
||||
/*! Axios v1.13.2 Copyright (c) 2025 Matt Zabriskie and contributors */
|
||||
/*! Axios v1.13.3 Copyright (c) 2026 Matt Zabriskie and contributors */
|
||||
'use strict';
|
||||
|
||||
const FormData$1 = require('form-data');
|
||||
@@ -291,10 +291,11 @@ 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} = {}) {
|
||||
@@ -371,7 +372,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
|
||||
* ```
|
||||
*
|
||||
@@ -408,15 +409,26 @@ 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$1(val)) {
|
||||
a[key] = bind(val, thisArg);
|
||||
Object.defineProperty(a, key, {
|
||||
value: bind(val, thisArg),
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
} else {
|
||||
a[key] = val;
|
||||
Object.defineProperty(a, key, {
|
||||
value: val,
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
}, {allOwnKeys});
|
||||
return a;
|
||||
@@ -447,7 +459,12 @@ const stripBOM = (content) => {
|
||||
*/
|
||||
const inherits = (constructor, superConstructor, props, descriptors) => {
|
||||
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
||||
constructor.prototype.constructor = constructor;
|
||||
Object.defineProperty(constructor.prototype, 'constructor', {
|
||||
value: constructor,
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(constructor, 'super', {
|
||||
value: superConstructor.prototype
|
||||
});
|
||||
@@ -820,110 +837,75 @@ const utils$1 = {
|
||||
isIterable
|
||||
};
|
||||
|
||||
/**
|
||||
* 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$1.toJSONObject(this.config),
|
||||
code: this.code,
|
||||
status: this.status,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
utils$1.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$1.toJSONObject(this.config),
|
||||
code: this.code,
|
||||
status: this.status
|
||||
};
|
||||
}
|
||||
});
|
||||
// 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';
|
||||
|
||||
const prototype$1 = 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$1, 'isAxiosError', {value: true});
|
||||
|
||||
// eslint-disable-next-line func-names
|
||||
AxiosError.from = (error, code, config, request, response, customProps) => {
|
||||
const axiosError = Object.create(prototype$1);
|
||||
|
||||
utils$1.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;
|
||||
};
|
||||
const AxiosError$1 = AxiosError;
|
||||
|
||||
/**
|
||||
* Determines if the given thing is a array or js object.
|
||||
@@ -1045,7 +1027,7 @@ function toFormData(obj, formData, options) {
|
||||
}
|
||||
|
||||
if (!useBlob && utils$1.isBlob(value)) {
|
||||
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
||||
throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
|
||||
}
|
||||
|
||||
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
||||
@@ -1219,29 +1201,26 @@ function encode(val) {
|
||||
* @returns {string} The formatted url
|
||||
*/
|
||||
function buildURL(url, params, options) {
|
||||
/*eslint no-param-reassign:0*/
|
||||
if (!params) {
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
const _encode = options && options.encode || encode;
|
||||
|
||||
if (utils$1.isFunction(options)) {
|
||||
options = {
|
||||
serialize: options
|
||||
};
|
||||
}
|
||||
const _options = utils$1.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$1.isURLSearchParams(params) ?
|
||||
params.toString() :
|
||||
new AxiosURLSearchParams(params, options).toString(_encode);
|
||||
new AxiosURLSearchParams(params, _options).toString(_encode);
|
||||
}
|
||||
|
||||
if (serializedParams) {
|
||||
@@ -1266,6 +1245,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
|
||||
*/
|
||||
@@ -1636,7 +1616,7 @@ const defaults = {
|
||||
} catch (e) {
|
||||
if (strictJSONParsing) {
|
||||
if (e.name === 'SyntaxError') {
|
||||
throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
|
||||
throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
@@ -2070,24 +2050,24 @@ function isCancel(value) {
|
||||
return !!(value && value.__CANCEL__);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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$1 {
|
||||
/**
|
||||
* 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$1.ERR_CANCELED, config, request);
|
||||
this.name = 'CanceledError';
|
||||
this.__CANCEL__ = true;
|
||||
}
|
||||
}
|
||||
|
||||
utils$1.inherits(CanceledError, AxiosError, {
|
||||
__CANCEL__: true
|
||||
});
|
||||
const CanceledError$1 = CanceledError;
|
||||
|
||||
/**
|
||||
* Resolve or reject a Promise based on response status.
|
||||
@@ -2103,9 +2083,9 @@ function settle(resolve, reject, response) {
|
||||
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
||||
resolve(response);
|
||||
} else {
|
||||
reject(new AxiosError(
|
||||
reject(new AxiosError$1(
|
||||
'Request failed with status code ' + response.status,
|
||||
[AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
||||
[AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
||||
response.config,
|
||||
response.request,
|
||||
response
|
||||
@@ -2159,7 +2139,7 @@ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
||||
return requestedURL;
|
||||
}
|
||||
|
||||
const VERSION = "1.13.2";
|
||||
const VERSION = "1.13.3";
|
||||
|
||||
function parseProtocol(url) {
|
||||
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
||||
@@ -2192,7 +2172,7 @@ function fromDataURI(uri, asBlob, options) {
|
||||
const match = DATA_URL_PATTERN.exec(uri);
|
||||
|
||||
if (!match) {
|
||||
throw new AxiosError('Invalid URL', AxiosError.ERR_INVALID_URL);
|
||||
throw new AxiosError$1('Invalid URL', AxiosError$1.ERR_INVALID_URL);
|
||||
}
|
||||
|
||||
const mime = match[1];
|
||||
@@ -2202,7 +2182,7 @@ function fromDataURI(uri, asBlob, options) {
|
||||
|
||||
if (asBlob) {
|
||||
if (!_Blob) {
|
||||
throw new AxiosError('Blob is not supported', AxiosError.ERR_NOT_SUPPORT);
|
||||
throw new AxiosError$1('Blob is not supported', AxiosError$1.ERR_NOT_SUPPORT);
|
||||
}
|
||||
|
||||
return new _Blob([buffer], {type: mime});
|
||||
@@ -2211,7 +2191,7 @@ function fromDataURI(uri, asBlob, options) {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT);
|
||||
throw new AxiosError$1('Unsupported protocol ' + protocol, AxiosError$1.ERR_NOT_SUPPORT);
|
||||
}
|
||||
|
||||
const kInternals = Symbol('internals');
|
||||
@@ -2893,12 +2873,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$1('Invalid proxy authorization', AxiosError$1.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;
|
||||
}
|
||||
|
||||
@@ -2964,7 +2948,8 @@ const buildAddressEntry = (address, family) => resolveFamily(utils$1.isObject(ad
|
||||
|
||||
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;
|
||||
|
||||
@@ -3051,7 +3036,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
||||
|
||||
function abort(reason) {
|
||||
try {
|
||||
abortEmitter.emit('abort', !reason || reason.type ? new CanceledError(null, config, req) : reason);
|
||||
abortEmitter.emit('abort', !reason || reason.type ? new CanceledError$1(null, config, req) : reason);
|
||||
} catch(err) {
|
||||
console.warn('emit error', err);
|
||||
}
|
||||
@@ -3116,9 +3101,9 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
||||
const estimated = estimateDataURLDecodedBytes(dataUrl);
|
||||
|
||||
if (estimated > config.maxContentLength) {
|
||||
return reject(new AxiosError(
|
||||
return reject(new AxiosError$1(
|
||||
'maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
||||
AxiosError.ERR_BAD_RESPONSE,
|
||||
AxiosError$1.ERR_BAD_RESPONSE,
|
||||
config
|
||||
));
|
||||
}
|
||||
@@ -3140,7 +3125,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
||||
Blob: config.env && config.env.Blob
|
||||
});
|
||||
} catch (err) {
|
||||
throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config);
|
||||
throw AxiosError$1.from(err, AxiosError$1.ERR_BAD_REQUEST, config);
|
||||
}
|
||||
|
||||
if (responseType === 'text') {
|
||||
@@ -3163,9 +3148,9 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
||||
}
|
||||
|
||||
if (supportedProtocols.indexOf(protocol) === -1) {
|
||||
return reject(new AxiosError(
|
||||
return reject(new AxiosError$1(
|
||||
'Unsupported protocol ' + protocol,
|
||||
AxiosError.ERR_BAD_REQUEST,
|
||||
AxiosError$1.ERR_BAD_REQUEST,
|
||||
config
|
||||
));
|
||||
}
|
||||
@@ -3215,9 +3200,9 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
||||
} else if (utils$1.isString(data)) {
|
||||
data = Buffer.from(data, 'utf-8');
|
||||
} else {
|
||||
return reject(new AxiosError(
|
||||
return reject(new AxiosError$1(
|
||||
'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
|
||||
AxiosError.ERR_BAD_REQUEST,
|
||||
AxiosError$1.ERR_BAD_REQUEST,
|
||||
config
|
||||
));
|
||||
}
|
||||
@@ -3226,9 +3211,9 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
||||
headers.setContentLength(data.length, false);
|
||||
|
||||
if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {
|
||||
return reject(new AxiosError(
|
||||
return reject(new AxiosError$1(
|
||||
'Request body larger than maxBodyLength limit',
|
||||
AxiosError.ERR_BAD_REQUEST,
|
||||
AxiosError$1.ERR_BAD_REQUEST,
|
||||
config
|
||||
));
|
||||
}
|
||||
@@ -3450,8 +3435,8 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
||||
// stream.destroy() emit aborted event before calling reject() on Node.js v16
|
||||
rejected = true;
|
||||
responseStream.destroy();
|
||||
abort(new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
||||
AxiosError.ERR_BAD_RESPONSE, config, lastRequest));
|
||||
abort(new AxiosError$1('maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
||||
AxiosError$1.ERR_BAD_RESPONSE, config, lastRequest));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -3460,9 +3445,9 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
||||
return;
|
||||
}
|
||||
|
||||
const err = new AxiosError(
|
||||
const err = new AxiosError$1(
|
||||
'stream has been aborted',
|
||||
AxiosError.ERR_BAD_RESPONSE,
|
||||
AxiosError$1.ERR_BAD_RESPONSE,
|
||||
config,
|
||||
lastRequest
|
||||
);
|
||||
@@ -3472,7 +3457,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
||||
|
||||
responseStream.on('error', function handleStreamError(err) {
|
||||
if (req.destroyed) return;
|
||||
reject(AxiosError.from(err, null, config, lastRequest));
|
||||
reject(AxiosError$1.from(err, null, config, lastRequest));
|
||||
});
|
||||
|
||||
responseStream.on('end', function handleStreamEnd() {
|
||||
@@ -3486,7 +3471,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
||||
}
|
||||
response.data = responseData;
|
||||
} catch (err) {
|
||||
return reject(AxiosError.from(err, null, config, response.request, response));
|
||||
return reject(AxiosError$1.from(err, null, config, response.request, response));
|
||||
}
|
||||
settle(resolve, reject, response);
|
||||
});
|
||||
@@ -3510,9 +3495,7 @@ const httpAdapter = 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));
|
||||
reject(AxiosError$1.from(err, null, config, req));
|
||||
});
|
||||
|
||||
// set tcp keep alive to prevent drop connection by peer
|
||||
@@ -3527,9 +3510,9 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
||||
const timeout = parseInt(config.timeout, 10);
|
||||
|
||||
if (Number.isNaN(timeout)) {
|
||||
abort(new AxiosError(
|
||||
abort(new AxiosError$1(
|
||||
'error trying to parse `config.timeout` to int',
|
||||
AxiosError.ERR_BAD_OPTION_VALUE,
|
||||
AxiosError$1.ERR_BAD_OPTION_VALUE,
|
||||
config,
|
||||
req
|
||||
));
|
||||
@@ -3549,9 +3532,9 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
||||
if (config.timeoutErrorMessage) {
|
||||
timeoutErrorMessage = config.timeoutErrorMessage;
|
||||
}
|
||||
abort(new AxiosError(
|
||||
abort(new AxiosError$1(
|
||||
timeoutErrorMessage,
|
||||
transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
||||
transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
||||
config,
|
||||
req
|
||||
));
|
||||
@@ -3578,7 +3561,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
||||
|
||||
data.on('close', () => {
|
||||
if (!ended && !errored) {
|
||||
abort(new CanceledError('Request stream has been aborted', config, req));
|
||||
abort(new CanceledError$1('Request stream has been aborted', config, req));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -3671,7 +3654,7 @@ function mergeConfig(config1, config2) {
|
||||
|
||||
function getMergedValue(target, source, prop, caseless) {
|
||||
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
||||
return utils$1.merge.call({caseless}, target, source);
|
||||
return utils$1.merge.call({ caseless }, target, source);
|
||||
} else if (utils$1.isPlainObject(source)) {
|
||||
return utils$1.merge({}, source);
|
||||
} else if (utils$1.isArray(source)) {
|
||||
@@ -3680,7 +3663,6 @@ function mergeConfig(config1, config2) {
|
||||
return source;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line consistent-return
|
||||
function mergeDeepProperties(a, b, prop, caseless) {
|
||||
if (!utils$1.isUndefined(b)) {
|
||||
return getMergedValue(a, b, prop, caseless);
|
||||
@@ -3746,7 +3728,7 @@ function mergeConfig(config1, config2) {
|
||||
headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
|
||||
};
|
||||
|
||||
utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
|
||||
utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
|
||||
const merge = mergeMap[prop] || mergeDeepProperties;
|
||||
const configValue = merge(config1[prop], config2[prop], prop);
|
||||
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
||||
@@ -3895,7 +3877,7 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
||||
return;
|
||||
}
|
||||
|
||||
reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
|
||||
reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
|
||||
|
||||
// Clean up request
|
||||
request = null;
|
||||
@@ -3907,7 +3889,7 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
||||
// (message may be empty; when present, surface it)
|
||||
// See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
|
||||
const msg = event && event.message ? event.message : 'Network Error';
|
||||
const err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);
|
||||
const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
|
||||
// attach the underlying event for consumers who want details
|
||||
err.event = event || null;
|
||||
reject(err);
|
||||
@@ -3921,9 +3903,9 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
||||
if (_config.timeoutErrorMessage) {
|
||||
timeoutErrorMessage = _config.timeoutErrorMessage;
|
||||
}
|
||||
reject(new AxiosError(
|
||||
reject(new AxiosError$1(
|
||||
timeoutErrorMessage,
|
||||
transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
||||
transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
||||
config,
|
||||
request));
|
||||
|
||||
@@ -3973,7 +3955,7 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
||||
if (!request) {
|
||||
return;
|
||||
}
|
||||
reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
|
||||
reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
|
||||
request.abort();
|
||||
request = null;
|
||||
};
|
||||
@@ -3987,7 +3969,7 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
||||
const protocol = parseProtocol(_config.url);
|
||||
|
||||
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
||||
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
|
||||
reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4010,13 +3992,13 @@ const composeSignals = (signals, timeout) => {
|
||||
aborted = true;
|
||||
unsubscribe();
|
||||
const err = reason instanceof Error ? reason : this.reason;
|
||||
controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
|
||||
controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
|
||||
}
|
||||
};
|
||||
|
||||
let timer = timeout && setTimeout(() => {
|
||||
timer = null;
|
||||
onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
|
||||
onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
|
||||
}, timeout);
|
||||
|
||||
const unsubscribe = () => {
|
||||
@@ -4202,7 +4184,7 @@ const factory = (env) => {
|
||||
return method.call(res);
|
||||
}
|
||||
|
||||
throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
|
||||
throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
|
||||
});
|
||||
});
|
||||
})());
|
||||
@@ -4368,14 +4350,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$1('Network Error', AxiosError$1.ERR_NETWORK, config, request),
|
||||
{
|
||||
cause: err.cause || err
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
throw AxiosError.from(err, err && err.code, config, request);
|
||||
throw AxiosError$1.from(err, err && err.code, config, request);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -4480,7 +4462,7 @@ function getAdapter(adapters, config) {
|
||||
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
||||
|
||||
if (adapter === undefined) {
|
||||
throw new AxiosError(`Unknown adapter '${id}'`);
|
||||
throw new AxiosError$1(`Unknown adapter '${id}'`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4501,7 +4483,7 @@ function getAdapter(adapters, config) {
|
||||
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
|
||||
'as no adapter specified';
|
||||
|
||||
throw new AxiosError(
|
||||
throw new AxiosError$1(
|
||||
`There is no suitable adapter to dispatch the request ` + s,
|
||||
'ERR_NOT_SUPPORT'
|
||||
);
|
||||
@@ -4540,7 +4522,7 @@ function throwIfCancellationRequested(config) {
|
||||
}
|
||||
|
||||
if (config.signal && config.signal.aborted) {
|
||||
throw new CanceledError(null, config);
|
||||
throw new CanceledError$1(null, config);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4628,9 +4610,9 @@ validators$1.transitional = function transitional(validator, version, message) {
|
||||
// eslint-disable-next-line func-names
|
||||
return (value, opt, opts) => {
|
||||
if (validator === false) {
|
||||
throw new AxiosError(
|
||||
throw new AxiosError$1(
|
||||
formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
|
||||
AxiosError.ERR_DEPRECATED
|
||||
AxiosError$1.ERR_DEPRECATED
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4669,7 +4651,7 @@ validators$1.spelling = function spelling(correctSpelling) {
|
||||
|
||||
function assertOptions(options, schema, allowUnknown) {
|
||||
if (typeof options !== 'object') {
|
||||
throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
|
||||
throw new AxiosError$1('options must be an object', AxiosError$1.ERR_BAD_OPTION_VALUE);
|
||||
}
|
||||
const keys = Object.keys(options);
|
||||
let i = keys.length;
|
||||
@@ -4680,12 +4662,12 @@ function assertOptions(options, schema, allowUnknown) {
|
||||
const value = options[opt];
|
||||
const result = value === undefined || validator(value, opt, options);
|
||||
if (result !== true) {
|
||||
throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
|
||||
throw new AxiosError$1('option ' + opt + ' must be ' + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (allowUnknown !== true) {
|
||||
throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
|
||||
throw new AxiosError$1('Unknown option ' + opt, AxiosError$1.ERR_BAD_OPTION);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4843,8 +4825,13 @@ class Axios {
|
||||
|
||||
promise = Promise.resolve(config);
|
||||
|
||||
let prevResult = config;
|
||||
while (i < len) {
|
||||
promise = promise.then(chain[i++], chain[i++]);
|
||||
promise = promise
|
||||
.then(chain[i++])
|
||||
.then(result => { prevResult = result !== undefined ? result : prevResult; })
|
||||
.catch(chain[i++])
|
||||
.then(() => prevResult);
|
||||
}
|
||||
|
||||
return promise;
|
||||
@@ -4875,7 +4862,7 @@ class Axios {
|
||||
len = responseInterceptorChain.length;
|
||||
|
||||
while (i < len) {
|
||||
promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
|
||||
promise = promise.then(responseInterceptorChain[i++]).catch(responseInterceptorChain[i++]);
|
||||
}
|
||||
|
||||
return promise;
|
||||
@@ -4978,7 +4965,7 @@ class CancelToken {
|
||||
return;
|
||||
}
|
||||
|
||||
token.reason = new CanceledError(message, config, request);
|
||||
token.reason = new CanceledError$1(message, config, request);
|
||||
resolvePromise(token.reason);
|
||||
});
|
||||
}
|
||||
@@ -5062,7 +5049,7 @@ const CancelToken$1 = CancelToken;
|
||||
*
|
||||
* ```js
|
||||
* function f(x, y, z) {}
|
||||
* var args = [1, 2, 3];
|
||||
* const args = [1, 2, 3];
|
||||
* f.apply(null, args);
|
||||
* ```
|
||||
*
|
||||
@@ -5203,14 +5190,14 @@ const axios = createInstance(defaults$1);
|
||||
axios.Axios = Axios$1;
|
||||
|
||||
// Expose Cancel & CancelToken
|
||||
axios.CanceledError = CanceledError;
|
||||
axios.CanceledError = CanceledError$1;
|
||||
axios.CancelToken = CancelToken$1;
|
||||
axios.isCancel = isCancel;
|
||||
axios.VERSION = VERSION;
|
||||
axios.toFormData = toFormData;
|
||||
|
||||
// Expose AxiosError class
|
||||
axios.AxiosError = AxiosError;
|
||||
axios.AxiosError = AxiosError$1;
|
||||
|
||||
// alias for CanceledError for backward compatibility
|
||||
axios.Cancel = axios.CanceledError;
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"file":"axios.cjs","sources":["../../lib/helpers/bind.js","../../lib/utils.js","../../lib/core/AxiosError.js","../../lib/helpers/toFormData.js","../../lib/helpers/AxiosURLSearchParams.js","../../lib/helpers/buildURL.js","../../lib/core/InterceptorManager.js","../../lib/defaults/transitional.js","../../lib/platform/node/classes/URLSearchParams.js","../../lib/platform/node/index.js","../../lib/platform/common/utils.js","../../lib/platform/index.js","../../lib/helpers/toURLEncodedForm.js","../../lib/helpers/formDataToJSON.js","../../lib/defaults/index.js","../../lib/helpers/parseHeaders.js","../../lib/core/AxiosHeaders.js","../../lib/core/transformData.js","../../lib/cancel/isCancel.js","../../lib/cancel/CanceledError.js","../../lib/core/settle.js","../../lib/helpers/isAbsoluteURL.js","../../lib/helpers/combineURLs.js","../../lib/core/buildFullPath.js","../../lib/env/data.js","../../lib/helpers/parseProtocol.js","../../lib/helpers/fromDataURI.js","../../lib/helpers/AxiosTransformStream.js","../../lib/helpers/readBlob.js","../../lib/helpers/formDataToStream.js","../../lib/helpers/ZlibHeaderTransformStream.js","../../lib/helpers/callbackify.js","../../lib/helpers/speedometer.js","../../lib/helpers/throttle.js","../../lib/helpers/progressEventReducer.js","../../lib/helpers/estimateDataURLDecodedBytes.js","../../lib/adapters/http.js","../../lib/helpers/isURLSameOrigin.js","../../lib/helpers/cookies.js","../../lib/core/mergeConfig.js","../../lib/helpers/resolveConfig.js","../../lib/adapters/xhr.js","../../lib/helpers/composeSignals.js","../../lib/helpers/trackStream.js","../../lib/adapters/fetch.js","../../lib/adapters/adapters.js","../../lib/core/dispatchRequest.js","../../lib/helpers/validator.js","../../lib/core/Axios.js","../../lib/cancel/CancelToken.js","../../lib/helpers/spread.js","../../lib/helpers/isAxiosError.js","../../lib/helpers/HttpStatusCode.js","../../lib/axios.js"],"sourcesContent":["'use strict';\n\n/**\n * Create a bound version of a function with a specified `this` context\n *\n * @param {Function} fn - The function to bind\n * @param {*} thisArg - The value to be passed as the `this` parameter\n * @returns {Function} A new function that will call the original function with the specified `this` context\n */\nexport default function bind(fn, thisArg) {\n return function wrap() {\n return fn.apply(thisArg, arguments);\n };\n}\n","'use strict';\n\nimport bind from './helpers/bind.js';\n\n// utils is a library of generic helper functions non-specific to axios\n\nconst {toString} = Object.prototype;\nconst {getPrototypeOf} = Object;\nconst {iterator, toStringTag} = Symbol;\n\nconst kindOf = (cache => thing => {\n const str = toString.call(thing);\n return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());\n})(Object.create(null));\n\nconst kindOfTest = (type) => {\n type = type.toLowerCase();\n return (thing) => kindOf(thing) === type\n}\n\nconst typeOfTest = type => thing => typeof thing === type;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n *\n * @returns {boolean} True if value is an Array, otherwise false\n */\nconst {isArray} = Array;\n\n/**\n * Determine if a value is undefined\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nconst isUndefined = typeOfTest('undefined');\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nconst isArrayBuffer = kindOfTest('ArrayBuffer');\n\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n let result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a String, otherwise false\n */\nconst isString = typeOfTest('string');\n\n/**\n * Determine if a value is a Function\n *\n * @param {*} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nconst isFunction = typeOfTest('function');\n\n/**\n * Determine if a value is a Number\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Number, othLine truncated
|
||||
{"version":3,"file":"axios.cjs","sources":["../../lib/helpers/bind.js","../../lib/utils.js","../../lib/core/AxiosError.js","../../lib/helpers/toFormData.js","../../lib/helpers/AxiosURLSearchParams.js","../../lib/helpers/buildURL.js","../../lib/core/InterceptorManager.js","../../lib/defaults/transitional.js","../../lib/platform/node/classes/URLSearchParams.js","../../lib/platform/node/index.js","../../lib/platform/common/utils.js","../../lib/platform/index.js","../../lib/helpers/toURLEncodedForm.js","../../lib/helpers/formDataToJSON.js","../../lib/defaults/index.js","../../lib/helpers/parseHeaders.js","../../lib/core/AxiosHeaders.js","../../lib/core/transformData.js","../../lib/cancel/isCancel.js","../../lib/cancel/CanceledError.js","../../lib/core/settle.js","../../lib/helpers/isAbsoluteURL.js","../../lib/helpers/combineURLs.js","../../lib/core/buildFullPath.js","../../lib/env/data.js","../../lib/helpers/parseProtocol.js","../../lib/helpers/fromDataURI.js","../../lib/helpers/AxiosTransformStream.js","../../lib/helpers/readBlob.js","../../lib/helpers/formDataToStream.js","../../lib/helpers/ZlibHeaderTransformStream.js","../../lib/helpers/callbackify.js","../../lib/helpers/speedometer.js","../../lib/helpers/throttle.js","../../lib/helpers/progressEventReducer.js","../../lib/helpers/estimateDataURLDecodedBytes.js","../../lib/adapters/http.js","../../lib/helpers/isURLSameOrigin.js","../../lib/helpers/cookies.js","../../lib/core/mergeConfig.js","../../lib/helpers/resolveConfig.js","../../lib/adapters/xhr.js","../../lib/helpers/composeSignals.js","../../lib/helpers/trackStream.js","../../lib/adapters/fetch.js","../../lib/adapters/adapters.js","../../lib/core/dispatchRequest.js","../../lib/helpers/validator.js","../../lib/core/Axios.js","../../lib/cancel/CancelToken.js","../../lib/helpers/spread.js","../../lib/helpers/isAxiosError.js","../../lib/helpers/HttpStatusCode.js","../../lib/axios.js"],"sourcesContent":["'use strict';\n\n/**\n * Create a bound version of a function with a specified `this` context\n *\n * @param {Function} fn - The function to bind\n * @param {*} thisArg - The value to be passed as the `this` parameter\n * @returns {Function} A new function that will call the original function with the specified `this` context\n */\nexport default function bind(fn, thisArg) {\n return function wrap() {\n return fn.apply(thisArg, arguments);\n };\n}\n","'use strict';\n\nimport bind from './helpers/bind.js';\n\n// utils is a library of generic helper functions non-specific to axios\n\nconst {toString} = Object.prototype;\nconst {getPrototypeOf} = Object;\nconst {iterator, toStringTag} = Symbol;\n\nconst kindOf = (cache => thing => {\n const str = toString.call(thing);\n return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());\n})(Object.create(null));\n\nconst kindOfTest = (type) => {\n type = type.toLowerCase();\n return (thing) => kindOf(thing) === type\n}\n\nconst typeOfTest = type => thing => typeof thing === type;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n *\n * @returns {boolean} True if value is an Array, otherwise false\n */\nconst {isArray} = Array;\n\n/**\n * Determine if a value is undefined\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nconst isUndefined = typeOfTest('undefined');\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nconst isArrayBuffer = kindOfTest('ArrayBuffer');\n\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n let result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a String, otherwise false\n */\nconst isString = typeOfTest('string');\n\n/**\n * Determine if a value is a Function\n *\n * @param {*} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nconst isFunction = typeOfTest('function');\n\n/**\n * Determine if a value is a Number\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Number, othLine truncated
|
||||
Reference in new issue
Block a user