| (function webpackUniversalModuleDefinition(root, factory) { |
| if(typeof exports === 'object' && typeof module === 'object') |
| module.exports = factory(); |
| else if(typeof define === 'function' && define.amd) |
| define([], factory); |
| else if(typeof exports === 'object') |
| exports["axios"] = factory(); |
| else |
| root["axios"] = factory(); |
| })(this, function() { |
| return (function(modules) { |
| |
| var installedModules = {}; |
| |
| |
| function __webpack_require__(moduleId) { |
| |
| |
| if(installedModules[moduleId]) { |
| return installedModules[moduleId].exports; |
| } |
| |
| var module = installedModules[moduleId] = { |
| i: moduleId, |
| l: false, |
| exports: {} |
| }; |
| |
| |
| modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
| |
| |
| module.l = true; |
| |
| |
| return module.exports; |
| } |
| |
| |
| |
| __webpack_require__.m = modules; |
| |
| |
| __webpack_require__.c = installedModules; |
| |
| |
| __webpack_require__.d = function(exports, name, getter) { |
| if(!__webpack_require__.o(exports, name)) { |
| Object.defineProperty(exports, name, { enumerable: true, get: getter }); |
| } |
| }; |
| |
| |
| __webpack_require__.r = function(exports) { |
| if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
| Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| } |
| Object.defineProperty(exports, '__esModule', { value: true }); |
| }; |
| |
| |
| |
| |
| |
| |
| __webpack_require__.t = function(value, mode) { |
| if(mode & 1) value = __webpack_require__(value); |
| if(mode & 8) return value; |
| if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; |
| var ns = Object.create(null); |
| __webpack_require__.r(ns); |
| Object.defineProperty(ns, 'default', { enumerable: true, value: value }); |
| if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); |
| return ns; |
| }; |
| |
| |
| __webpack_require__.n = function(module) { |
| var getter = module && module.__esModule ? |
| function getDefault() { return module['default']; } : |
| function getModuleExports() { return module; }; |
| __webpack_require__.d(getter, 'a', getter); |
| return getter; |
| }; |
| |
| |
| __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
| |
| |
| __webpack_require__.p = ""; |
| |
| |
| |
| return __webpack_require__(__webpack_require__.s = "./index.js"); |
| }) |
| |
| ({ |
|
|
| "./index.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| module.exports = __webpack_require__( "./lib/axios.js"); |
|
|
| }), |
|
|
| "./lib/adapters/xhr.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| var utils = __webpack_require__( "./lib/utils.js"); |
| var settle = __webpack_require__( "./lib/core/settle.js"); |
| var cookies = __webpack_require__( "./lib/helpers/cookies.js"); |
| var buildURL = __webpack_require__( "./lib/helpers/buildURL.js"); |
| var buildFullPath = __webpack_require__( "./lib/core/buildFullPath.js"); |
| var parseHeaders = __webpack_require__( "./lib/helpers/parseHeaders.js"); |
| var isURLSameOrigin = __webpack_require__( "./lib/helpers/isURLSameOrigin.js"); |
| var createError = __webpack_require__( "./lib/core/createError.js"); |
| var transitionalDefaults = __webpack_require__( "./lib/defaults/transitional.js"); |
| var Cancel = __webpack_require__( "./lib/cancel/Cancel.js"); |
|
|
| module.exports = function xhrAdapter(config) { |
| return new Promise(function dispatchXhrRequest(resolve, reject) { |
| var requestData = config.data; |
| var requestHeaders = config.headers; |
| var responseType = config.responseType; |
| var onCanceled; |
| function done() { |
| if (config.cancelToken) { |
| config.cancelToken.unsubscribe(onCanceled); |
| } |
|
|
| if (config.signal) { |
| config.signal.removeEventListener('abort', onCanceled); |
| } |
| } |
|
|
| if (utils.isFormData(requestData)) { |
| delete requestHeaders['Content-Type']; |
| } |
|
|
| var request = new XMLHttpRequest(); |
|
|
| |
| if (config.auth) { |
| var username = config.auth.username || ''; |
| var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : ''; |
| requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); |
| } |
|
|
| var fullPath = buildFullPath(config.baseURL, config.url); |
| request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true); |
|
|
| |
| request.timeout = config.timeout; |
|
|
| function onloadend() { |
| if (!request) { |
| return; |
| } |
| |
| var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; |
| var responseData = !responseType || responseType === 'text' || responseType === 'json' ? |
| request.responseText : request.response; |
| var response = { |
| data: responseData, |
| status: request.status, |
| statusText: request.statusText, |
| headers: responseHeaders, |
| config: config, |
| request: request |
| }; |
|
|
| settle(function _resolve(value) { |
| resolve(value); |
| done(); |
| }, function _reject(err) { |
| reject(err); |
| done(); |
| }, response); |
|
|
| |
| request = null; |
| } |
|
|
| if ('onloadend' in request) { |
| |
| request.onloadend = onloadend; |
| } else { |
| |
| request.onreadystatechange = function handleLoad() { |
| if (!request || request.readyState !== 4) { |
| return; |
| } |
|
|
| |
| |
| |
| |
| if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { |
| return; |
| } |
| |
| |
| setTimeout(onloadend); |
| }; |
| } |
|
|
| |
| request.onabort = function handleAbort() { |
| if (!request) { |
| return; |
| } |
|
|
| reject(createError('Request aborted', config, 'ECONNABORTED', request)); |
|
|
| |
| request = null; |
| }; |
|
|
| |
| request.onerror = function handleError() { |
| |
| |
| reject(createError('Network Error', config, null, request)); |
|
|
| |
| request = null; |
| }; |
|
|
| |
| request.ontimeout = function handleTimeout() { |
| var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded'; |
| var transitional = config.transitional || transitionalDefaults; |
| if (config.timeoutErrorMessage) { |
| timeoutErrorMessage = config.timeoutErrorMessage; |
| } |
| reject(createError( |
| timeoutErrorMessage, |
| config, |
| transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED', |
| request)); |
|
|
| |
| request = null; |
| }; |
|
|
| |
| |
| |
| if (utils.isStandardBrowserEnv()) { |
| |
| var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? |
| cookies.read(config.xsrfCookieName) : |
| undefined; |
|
|
| if (xsrfValue) { |
| requestHeaders[config.xsrfHeaderName] = xsrfValue; |
| } |
| } |
|
|
| |
| if ('setRequestHeader' in request) { |
| utils.forEach(requestHeaders, function setRequestHeader(val, key) { |
| if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { |
| |
| delete requestHeaders[key]; |
| } else { |
| |
| request.setRequestHeader(key, val); |
| } |
| }); |
| } |
|
|
| |
| if (!utils.isUndefined(config.withCredentials)) { |
| request.withCredentials = !!config.withCredentials; |
| } |
|
|
| |
| if (responseType && responseType !== 'json') { |
| request.responseType = config.responseType; |
| } |
|
|
| |
| if (typeof config.onDownloadProgress === 'function') { |
| request.addEventListener('progress', config.onDownloadProgress); |
| } |
|
|
| |
| if (typeof config.onUploadProgress === 'function' && request.upload) { |
| request.upload.addEventListener('progress', config.onUploadProgress); |
| } |
|
|
| if (config.cancelToken || config.signal) { |
| |
| |
| onCanceled = function(cancel) { |
| if (!request) { |
| return; |
| } |
| reject(!cancel || (cancel && cancel.type) ? new Cancel('canceled') : cancel); |
| request.abort(); |
| request = null; |
| }; |
|
|
| config.cancelToken && config.cancelToken.subscribe(onCanceled); |
| if (config.signal) { |
| config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled); |
| } |
| } |
|
|
| if (!requestData) { |
| requestData = null; |
| } |
|
|
| |
| request.send(requestData); |
| }); |
| }; |
|
|
|
|
| }), |
|
|
| "./lib/axios.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| var utils = __webpack_require__( "./lib/utils.js"); |
| var bind = __webpack_require__( "./lib/helpers/bind.js"); |
| var Axios = __webpack_require__( "./lib/core/Axios.js"); |
| var mergeConfig = __webpack_require__( "./lib/core/mergeConfig.js"); |
| var defaults = __webpack_require__( "./lib/defaults/index.js"); |
|
|
| |
| |
| |
| |
| |
| |
| function createInstance(defaultConfig) { |
| var context = new Axios(defaultConfig); |
| var instance = bind(Axios.prototype.request, context); |
|
|
| |
| utils.extend(instance, Axios.prototype, context); |
|
|
| |
| utils.extend(instance, context); |
|
|
| |
| instance.create = function create(instanceConfig) { |
| return createInstance(mergeConfig(defaultConfig, instanceConfig)); |
| }; |
|
|
| return instance; |
| } |
|
|
| |
| var axios = createInstance(defaults); |
|
|
| |
| axios.Axios = Axios; |
|
|
| |
| axios.Cancel = __webpack_require__( "./lib/cancel/Cancel.js"); |
| axios.CancelToken = __webpack_require__( "./lib/cancel/CancelToken.js"); |
| axios.isCancel = __webpack_require__( "./lib/cancel/isCancel.js"); |
| axios.VERSION = __webpack_require__( "./lib/env/data.js").version; |
|
|
| |
| axios.all = function all(promises) { |
| return Promise.all(promises); |
| }; |
| axios.spread = __webpack_require__( "./lib/helpers/spread.js"); |
|
|
| |
| axios.isAxiosError = __webpack_require__( "./lib/helpers/isAxiosError.js"); |
|
|
| module.exports = axios; |
|
|
| |
| module.exports.default = axios; |
|
|
|
|
| }), |
|
|
| "./lib/cancel/Cancel.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| |
| |
| |
| |
| |
| |
| function Cancel(message) { |
| this.message = message; |
| } |
|
|
| Cancel.prototype.toString = function toString() { |
| return 'Cancel' + (this.message ? ': ' + this.message : ''); |
| }; |
|
|
| Cancel.prototype.__CANCEL__ = true; |
|
|
| module.exports = Cancel; |
|
|
|
|
| }), |
|
|
| "./lib/cancel/CancelToken.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| var Cancel = __webpack_require__( "./lib/cancel/Cancel.js"); |
|
|
| |
| |
| |
| |
| |
| |
| function CancelToken(executor) { |
| if (typeof executor !== 'function') { |
| throw new TypeError('executor must be a function.'); |
| } |
|
|
| var resolvePromise; |
|
|
| this.promise = new Promise(function promiseExecutor(resolve) { |
| resolvePromise = resolve; |
| }); |
|
|
| var token = this; |
|
|
| |
| this.promise.then(function(cancel) { |
| if (!token._listeners) return; |
|
|
| var i; |
| var l = token._listeners.length; |
|
|
| for (i = 0; i < l; i++) { |
| token._listeners[i](cancel); |
| } |
| token._listeners = null; |
| }); |
|
|
| |
| this.promise.then = function(onfulfilled) { |
| var _resolve; |
| |
| var promise = new Promise(function(resolve) { |
| token.subscribe(resolve); |
| _resolve = resolve; |
| }).then(onfulfilled); |
|
|
| promise.cancel = function reject() { |
| token.unsubscribe(_resolve); |
| }; |
|
|
| return promise; |
| }; |
|
|
| executor(function cancel(message) { |
| if (token.reason) { |
| |
| return; |
| } |
|
|
| token.reason = new Cancel(message); |
| resolvePromise(token.reason); |
| }); |
| } |
|
|
| |
| |
| |
| CancelToken.prototype.throwIfRequested = function throwIfRequested() { |
| if (this.reason) { |
| throw this.reason; |
| } |
| }; |
|
|
| |
| |
| |
|
|
| CancelToken.prototype.subscribe = function subscribe(listener) { |
| if (this.reason) { |
| listener(this.reason); |
| return; |
| } |
|
|
| if (this._listeners) { |
| this._listeners.push(listener); |
| } else { |
| this._listeners = [listener]; |
| } |
| }; |
|
|
| |
| |
| |
|
|
| CancelToken.prototype.unsubscribe = function unsubscribe(listener) { |
| if (!this._listeners) { |
| return; |
| } |
| var index = this._listeners.indexOf(listener); |
| if (index !== -1) { |
| this._listeners.splice(index, 1); |
| } |
| }; |
|
|
| |
| |
| |
| |
| CancelToken.source = function source() { |
| var cancel; |
| var token = new CancelToken(function executor(c) { |
| cancel = c; |
| }); |
| return { |
| token: token, |
| cancel: cancel |
| }; |
| }; |
|
|
| module.exports = CancelToken; |
|
|
|
|
| }), |
|
|
| "./lib/cancel/isCancel.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| module.exports = function isCancel(value) { |
| return !!(value && value.__CANCEL__); |
| }; |
|
|
|
|
| }), |
|
|
| "./lib/core/Axios.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| var utils = __webpack_require__( "./lib/utils.js"); |
| var buildURL = __webpack_require__( "./lib/helpers/buildURL.js"); |
| var InterceptorManager = __webpack_require__( "./lib/core/InterceptorManager.js"); |
| var dispatchRequest = __webpack_require__( "./lib/core/dispatchRequest.js"); |
| var mergeConfig = __webpack_require__( "./lib/core/mergeConfig.js"); |
| var validator = __webpack_require__( "./lib/helpers/validator.js"); |
|
|
| var validators = validator.validators; |
| |
| |
| |
| |
| |
| function Axios(instanceConfig) { |
| this.defaults = instanceConfig; |
| this.interceptors = { |
| request: new InterceptorManager(), |
| response: new InterceptorManager() |
| }; |
| } |
|
|
| |
| |
| |
| |
| |
| Axios.prototype.request = function request(configOrUrl, config) { |
| |
| |
| if (typeof configOrUrl === 'string') { |
| config = config || {}; |
| config.url = configOrUrl; |
| } else { |
| config = configOrUrl || {}; |
| } |
|
|
| config = mergeConfig(this.defaults, config); |
|
|
| |
| if (config.method) { |
| config.method = config.method.toLowerCase(); |
| } else if (this.defaults.method) { |
| config.method = this.defaults.method.toLowerCase(); |
| } else { |
| config.method = 'get'; |
| } |
|
|
| var transitional = config.transitional; |
|
|
| if (transitional !== undefined) { |
| validator.assertOptions(transitional, { |
| silentJSONParsing: validators.transitional(validators.boolean), |
| forcedJSONParsing: validators.transitional(validators.boolean), |
| clarifyTimeoutError: validators.transitional(validators.boolean) |
| }, false); |
| } |
|
|
| |
| var requestInterceptorChain = []; |
| var synchronousRequestInterceptors = true; |
| this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { |
| if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) { |
| return; |
| } |
|
|
| synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; |
|
|
| requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); |
| }); |
|
|
| var responseInterceptorChain = []; |
| this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { |
| responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); |
| }); |
|
|
| var promise; |
|
|
| if (!synchronousRequestInterceptors) { |
| var chain = [dispatchRequest, undefined]; |
|
|
| Array.prototype.unshift.apply(chain, requestInterceptorChain); |
| chain = chain.concat(responseInterceptorChain); |
|
|
| promise = Promise.resolve(config); |
| while (chain.length) { |
| promise = promise.then(chain.shift(), chain.shift()); |
| } |
|
|
| return promise; |
| } |
|
|
|
|
| var newConfig = config; |
| while (requestInterceptorChain.length) { |
| var onFulfilled = requestInterceptorChain.shift(); |
| var onRejected = requestInterceptorChain.shift(); |
| try { |
| newConfig = onFulfilled(newConfig); |
| } catch (error) { |
| onRejected(error); |
| break; |
| } |
| } |
|
|
| try { |
| promise = dispatchRequest(newConfig); |
| } catch (error) { |
| return Promise.reject(error); |
| } |
|
|
| while (responseInterceptorChain.length) { |
| promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift()); |
| } |
|
|
| return promise; |
| }; |
|
|
| Axios.prototype.getUri = function getUri(config) { |
| config = mergeConfig(this.defaults, config); |
| return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, ''); |
| }; |
|
|
| |
| utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { |
| |
| Axios.prototype[method] = function(url, config) { |
| return this.request(mergeConfig(config || {}, { |
| method: method, |
| url: url, |
| data: (config || {}).data |
| })); |
| }; |
| }); |
|
|
| utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { |
| |
| Axios.prototype[method] = function(url, data, config) { |
| return this.request(mergeConfig(config || {}, { |
| method: method, |
| url: url, |
| data: data |
| })); |
| }; |
| }); |
|
|
| module.exports = Axios; |
|
|
|
|
| }), |
|
|
| "./lib/core/InterceptorManager.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| var utils = __webpack_require__( "./lib/utils.js"); |
|
|
| function InterceptorManager() { |
| this.handlers = []; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| InterceptorManager.prototype.use = function use(fulfilled, rejected, options) { |
| this.handlers.push({ |
| fulfilled: fulfilled, |
| rejected: rejected, |
| synchronous: options ? options.synchronous : false, |
| runWhen: options ? options.runWhen : null |
| }); |
| return this.handlers.length - 1; |
| }; |
|
|
| |
| |
| |
| |
| |
| InterceptorManager.prototype.eject = function eject(id) { |
| if (this.handlers[id]) { |
| this.handlers[id] = null; |
| } |
| }; |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| InterceptorManager.prototype.forEach = function forEach(fn) { |
| utils.forEach(this.handlers, function forEachHandler(h) { |
| if (h !== null) { |
| fn(h); |
| } |
| }); |
| }; |
|
|
| module.exports = InterceptorManager; |
|
|
|
|
| }), |
|
|
| "./lib/core/buildFullPath.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| var isAbsoluteURL = __webpack_require__( "./lib/helpers/isAbsoluteURL.js"); |
| var combineURLs = __webpack_require__( "./lib/helpers/combineURLs.js"); |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| module.exports = function buildFullPath(baseURL, requestedURL) { |
| if (baseURL && !isAbsoluteURL(requestedURL)) { |
| return combineURLs(baseURL, requestedURL); |
| } |
| return requestedURL; |
| }; |
|
|
|
|
| }), |
|
|
| "./lib/core/createError.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| var enhanceError = __webpack_require__( "./lib/core/enhanceError.js"); |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| module.exports = function createError(message, config, code, request, response) { |
| var error = new Error(message); |
| return enhanceError(error, config, code, request, response); |
| }; |
|
|
|
|
| }), |
|
|
| "./lib/core/dispatchRequest.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| var utils = __webpack_require__( "./lib/utils.js"); |
| var transformData = __webpack_require__( "./lib/core/transformData.js"); |
| var isCancel = __webpack_require__( "./lib/cancel/isCancel.js"); |
| var defaults = __webpack_require__( "./lib/defaults/index.js"); |
| var Cancel = __webpack_require__( "./lib/cancel/Cancel.js"); |
|
|
| |
| |
| |
| function throwIfCancellationRequested(config) { |
| if (config.cancelToken) { |
| config.cancelToken.throwIfRequested(); |
| } |
|
|
| if (config.signal && config.signal.aborted) { |
| throw new Cancel('canceled'); |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| module.exports = function dispatchRequest(config) { |
| throwIfCancellationRequested(config); |
|
|
| |
| config.headers = config.headers || {}; |
|
|
| |
| config.data = transformData.call( |
| config, |
| config.data, |
| config.headers, |
| config.transformRequest |
| ); |
|
|
| |
| config.headers = utils.merge( |
| config.headers.common || {}, |
| config.headers[config.method] || {}, |
| config.headers |
| ); |
|
|
| utils.forEach( |
| ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], |
| function cleanHeaderConfig(method) { |
| delete config.headers[method]; |
| } |
| ); |
|
|
| var adapter = config.adapter || defaults.adapter; |
|
|
| return adapter(config).then(function onAdapterResolution(response) { |
| throwIfCancellationRequested(config); |
|
|
| |
| response.data = transformData.call( |
| config, |
| response.data, |
| response.headers, |
| config.transformResponse |
| ); |
|
|
| return response; |
| }, function onAdapterRejection(reason) { |
| if (!isCancel(reason)) { |
| throwIfCancellationRequested(config); |
|
|
| |
| if (reason && reason.response) { |
| reason.response.data = transformData.call( |
| config, |
| reason.response.data, |
| reason.response.headers, |
| config.transformResponse |
| ); |
| } |
| } |
|
|
| return Promise.reject(reason); |
| }); |
| }; |
|
|
|
|
| }), |
|
|
| "./lib/core/enhanceError.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| module.exports = function enhanceError(error, config, code, request, response) { |
| error.config = config; |
| if (code) { |
| error.code = code; |
| } |
|
|
| error.request = request; |
| error.response = response; |
| error.isAxiosError = true; |
|
|
| error.toJSON = function toJSON() { |
| return { |
| |
| message: this.message, |
| name: this.name, |
| |
| description: this.description, |
| number: this.number, |
| |
| fileName: this.fileName, |
| lineNumber: this.lineNumber, |
| columnNumber: this.columnNumber, |
| stack: this.stack, |
| |
| config: this.config, |
| code: this.code, |
| status: this.response && this.response.status ? this.response.status : null |
| }; |
| }; |
| return error; |
| }; |
|
|
|
|
| }), |
|
|
| "./lib/core/mergeConfig.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| var utils = __webpack_require__( "./lib/utils.js"); |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| module.exports = function mergeConfig(config1, config2) { |
| |
| config2 = config2 || {}; |
| var config = {}; |
|
|
| function getMergedValue(target, source) { |
| if (utils.isPlainObject(target) && utils.isPlainObject(source)) { |
| return utils.merge(target, source); |
| } else if (utils.isPlainObject(source)) { |
| return utils.merge({}, source); |
| } else if (utils.isArray(source)) { |
| return source.slice(); |
| } |
| return source; |
| } |
|
|
| |
| function mergeDeepProperties(prop) { |
| if (!utils.isUndefined(config2[prop])) { |
| return getMergedValue(config1[prop], config2[prop]); |
| } else if (!utils.isUndefined(config1[prop])) { |
| return getMergedValue(undefined, config1[prop]); |
| } |
| } |
|
|
| |
| function valueFromConfig2(prop) { |
| if (!utils.isUndefined(config2[prop])) { |
| return getMergedValue(undefined, config2[prop]); |
| } |
| } |
|
|
| |
| function defaultToConfig2(prop) { |
| if (!utils.isUndefined(config2[prop])) { |
| return getMergedValue(undefined, config2[prop]); |
| } else if (!utils.isUndefined(config1[prop])) { |
| return getMergedValue(undefined, config1[prop]); |
| } |
| } |
|
|
| |
| function mergeDirectKeys(prop) { |
| if (prop in config2) { |
| return getMergedValue(config1[prop], config2[prop]); |
| } else if (prop in config1) { |
| return getMergedValue(undefined, config1[prop]); |
| } |
| } |
|
|
| var mergeMap = { |
| 'url': valueFromConfig2, |
| 'method': valueFromConfig2, |
| 'data': valueFromConfig2, |
| 'baseURL': defaultToConfig2, |
| 'transformRequest': defaultToConfig2, |
| 'transformResponse': defaultToConfig2, |
| 'paramsSerializer': defaultToConfig2, |
| 'timeout': defaultToConfig2, |
| 'timeoutMessage': defaultToConfig2, |
| 'withCredentials': defaultToConfig2, |
| 'adapter': defaultToConfig2, |
| 'responseType': defaultToConfig2, |
| 'xsrfCookieName': defaultToConfig2, |
| 'xsrfHeaderName': defaultToConfig2, |
| 'onUploadProgress': defaultToConfig2, |
| 'onDownloadProgress': defaultToConfig2, |
| 'decompress': defaultToConfig2, |
| 'maxContentLength': defaultToConfig2, |
| 'maxBodyLength': defaultToConfig2, |
| 'transport': defaultToConfig2, |
| 'httpAgent': defaultToConfig2, |
| 'httpsAgent': defaultToConfig2, |
| 'cancelToken': defaultToConfig2, |
| 'socketPath': defaultToConfig2, |
| 'responseEncoding': defaultToConfig2, |
| 'validateStatus': mergeDirectKeys |
| }; |
|
|
| utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) { |
| var merge = mergeMap[prop] || mergeDeepProperties; |
| var configValue = merge(prop); |
| (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue); |
| }); |
|
|
| return config; |
| }; |
|
|
|
|
| }), |
|
|
| "./lib/core/settle.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| var createError = __webpack_require__( "./lib/core/createError.js"); |
|
|
| |
| |
| |
| |
| |
| |
| |
| module.exports = function settle(resolve, reject, response) { |
| var validateStatus = response.config.validateStatus; |
| if (!response.status || !validateStatus || validateStatus(response.status)) { |
| resolve(response); |
| } else { |
| reject(createError( |
| 'Request failed with status code ' + response.status, |
| response.config, |
| null, |
| response.request, |
| response |
| )); |
| } |
| }; |
|
|
|
|
| }), |
|
|
| "./lib/core/transformData.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| var utils = __webpack_require__( "./lib/utils.js"); |
| var defaults = __webpack_require__( "./lib/defaults/index.js"); |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| module.exports = function transformData(data, headers, fns) { |
| var context = this || defaults; |
| |
| utils.forEach(fns, function transform(fn) { |
| data = fn.call(context, data, headers); |
| }); |
|
|
| return data; |
| }; |
|
|
|
|
| }), |
|
|
| "./lib/defaults/index.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| var utils = __webpack_require__( "./lib/utils.js"); |
| var normalizeHeaderName = __webpack_require__( "./lib/helpers/normalizeHeaderName.js"); |
| var enhanceError = __webpack_require__( "./lib/core/enhanceError.js"); |
| var transitionalDefaults = __webpack_require__( "./lib/defaults/transitional.js"); |
|
|
| var DEFAULT_CONTENT_TYPE = { |
| 'Content-Type': 'application/x-www-form-urlencoded' |
| }; |
|
|
| function setContentTypeIfUnset(headers, value) { |
| if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { |
| headers['Content-Type'] = value; |
| } |
| } |
|
|
| function getDefaultAdapter() { |
| var adapter; |
| if (typeof XMLHttpRequest !== 'undefined') { |
| |
| adapter = __webpack_require__( "./lib/adapters/xhr.js"); |
| } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') { |
| |
| adapter = __webpack_require__( "./lib/adapters/xhr.js"); |
| } |
| return adapter; |
| } |
|
|
| function stringifySafely(rawValue, parser, encoder) { |
| if (utils.isString(rawValue)) { |
| try { |
| (parser || JSON.parse)(rawValue); |
| return utils.trim(rawValue); |
| } catch (e) { |
| if (e.name !== 'SyntaxError') { |
| throw e; |
| } |
| } |
| } |
|
|
| return (encoder || JSON.stringify)(rawValue); |
| } |
|
|
| var defaults = { |
|
|
| transitional: transitionalDefaults, |
|
|
| adapter: getDefaultAdapter(), |
|
|
| transformRequest: [function transformRequest(data, headers) { |
| normalizeHeaderName(headers, 'Accept'); |
| normalizeHeaderName(headers, 'Content-Type'); |
|
|
| if (utils.isFormData(data) || |
| utils.isArrayBuffer(data) || |
| utils.isBuffer(data) || |
| utils.isStream(data) || |
| utils.isFile(data) || |
| utils.isBlob(data) |
| ) { |
| return data; |
| } |
| if (utils.isArrayBufferView(data)) { |
| return data.buffer; |
| } |
| if (utils.isURLSearchParams(data)) { |
| setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); |
| return data.toString(); |
| } |
| if (utils.isObject(data) || (headers && headers['Content-Type'] === 'application/json')) { |
| setContentTypeIfUnset(headers, 'application/json'); |
| return stringifySafely(data); |
| } |
| return data; |
| }], |
|
|
| transformResponse: [function transformResponse(data) { |
| var transitional = this.transitional || defaults.transitional; |
| var silentJSONParsing = transitional && transitional.silentJSONParsing; |
| var forcedJSONParsing = transitional && transitional.forcedJSONParsing; |
| var strictJSONParsing = !silentJSONParsing && this.responseType === 'json'; |
|
|
| if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) { |
| try { |
| return JSON.parse(data); |
| } catch (e) { |
| if (strictJSONParsing) { |
| if (e.name === 'SyntaxError') { |
| throw enhanceError(e, this, 'E_JSON_PARSE'); |
| } |
| throw e; |
| } |
| } |
| } |
|
|
| return data; |
| }], |
|
|
| |
| |
| |
| |
| timeout: 0, |
|
|
| xsrfCookieName: 'XSRF-TOKEN', |
| xsrfHeaderName: 'X-XSRF-TOKEN', |
|
|
| maxContentLength: -1, |
| maxBodyLength: -1, |
|
|
| validateStatus: function validateStatus(status) { |
| return status >= 200 && status < 300; |
| }, |
|
|
| headers: { |
| common: { |
| 'Accept': 'application/json, text/plain, */*' |
| } |
| } |
| }; |
|
|
| utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { |
| defaults.headers[method] = {}; |
| }); |
|
|
| utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { |
| defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); |
| }); |
|
|
| module.exports = defaults; |
|
|
|
|
| }), |
|
|
| "./lib/defaults/transitional.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| module.exports = { |
| silentJSONParsing: true, |
| forcedJSONParsing: true, |
| clarifyTimeoutError: false |
| }; |
|
|
|
|
| }), |
|
|
| "./lib/env/data.js": |
| |
| |
| |
| |
| (function(module, exports) { |
|
|
| module.exports = { |
| "version": "0.26.1" |
| }; |
|
|
| }), |
|
|
| "./lib/helpers/bind.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| module.exports = function bind(fn, thisArg) { |
| return function wrap() { |
| var args = new Array(arguments.length); |
| for (var i = 0; i < args.length; i++) { |
| args[i] = arguments[i]; |
| } |
| return fn.apply(thisArg, args); |
| }; |
| }; |
|
|
|
|
| }), |
|
|
| "./lib/helpers/buildURL.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| var utils = __webpack_require__( "./lib/utils.js"); |
|
|
| function encode(val) { |
| return encodeURIComponent(val). |
| replace(/%3A/gi, ':'). |
| replace(/%24/g, '$'). |
| replace(/%2C/gi, ','). |
| replace(/%20/g, '+'). |
| replace(/%5B/gi, '['). |
| replace(/%5D/gi, ']'); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| module.exports = function buildURL(url, params, paramsSerializer) { |
| |
| if (!params) { |
| return url; |
| } |
|
|
| var serializedParams; |
| if (paramsSerializer) { |
| serializedParams = paramsSerializer(params); |
| } else if (utils.isURLSearchParams(params)) { |
| serializedParams = params.toString(); |
| } else { |
| var parts = []; |
|
|
| utils.forEach(params, function serialize(val, key) { |
| if (val === null || typeof val === 'undefined') { |
| return; |
| } |
|
|
| if (utils.isArray(val)) { |
| key = key + '[]'; |
| } else { |
| val = [val]; |
| } |
|
|
| utils.forEach(val, function parseValue(v) { |
| if (utils.isDate(v)) { |
| v = v.toISOString(); |
| } else if (utils.isObject(v)) { |
| v = JSON.stringify(v); |
| } |
| parts.push(encode(key) + '=' + encode(v)); |
| }); |
| }); |
|
|
| serializedParams = parts.join('&'); |
| } |
|
|
| if (serializedParams) { |
| var hashmarkIndex = url.indexOf('#'); |
| if (hashmarkIndex !== -1) { |
| url = url.slice(0, hashmarkIndex); |
| } |
|
|
| url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; |
| } |
|
|
| return url; |
| }; |
|
|
|
|
| }), |
|
|
| "./lib/helpers/combineURLs.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| |
| |
| |
| |
| |
| |
| |
| module.exports = function combineURLs(baseURL, relativeURL) { |
| return relativeURL |
| ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') |
| : baseURL; |
| }; |
|
|
|
|
| }), |
|
|
| "./lib/helpers/cookies.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| var utils = __webpack_require__( "./lib/utils.js"); |
|
|
| module.exports = ( |
| utils.isStandardBrowserEnv() ? |
|
|
| |
| (function standardBrowserEnv() { |
| return { |
| write: function write(name, value, expires, path, domain, secure) { |
| var cookie = []; |
| cookie.push(name + '=' + encodeURIComponent(value)); |
|
|
| if (utils.isNumber(expires)) { |
| cookie.push('expires=' + new Date(expires).toGMTString()); |
| } |
|
|
| if (utils.isString(path)) { |
| cookie.push('path=' + path); |
| } |
|
|
| if (utils.isString(domain)) { |
| cookie.push('domain=' + domain); |
| } |
|
|
| if (secure === true) { |
| cookie.push('secure'); |
| } |
|
|
| document.cookie = cookie.join('; '); |
| }, |
|
|
| read: function read(name) { |
| var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); |
| return (match ? decodeURIComponent(match[3]) : null); |
| }, |
|
|
| remove: function remove(name) { |
| this.write(name, '', Date.now() - 86400000); |
| } |
| }; |
| })() : |
|
|
| |
| (function nonStandardBrowserEnv() { |
| return { |
| write: function write() {}, |
| read: function read() { return null; }, |
| remove: function remove() {} |
| }; |
| })() |
| ); |
|
|
|
|
| }), |
|
|
| "./lib/helpers/isAbsoluteURL.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| |
| |
| |
| |
| |
| |
| module.exports = function isAbsoluteURL(url) { |
| |
| |
| |
| return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url); |
| }; |
|
|
|
|
| }), |
|
|
| "./lib/helpers/isAxiosError.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| var utils = __webpack_require__( "./lib/utils.js"); |
|
|
| |
| |
| |
| |
| |
| |
| module.exports = function isAxiosError(payload) { |
| return utils.isObject(payload) && (payload.isAxiosError === true); |
| }; |
|
|
|
|
| }), |
|
|
| "./lib/helpers/isURLSameOrigin.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| var utils = __webpack_require__( "./lib/utils.js"); |
|
|
| module.exports = ( |
| utils.isStandardBrowserEnv() ? |
|
|
| |
| |
| (function standardBrowserEnv() { |
| var msie = /(msie|trident)/i.test(navigator.userAgent); |
| var urlParsingNode = document.createElement('a'); |
| var originURL; |
|
|
| |
| |
| |
| |
| |
| |
| function resolveURL(url) { |
| var href = url; |
|
|
| if (msie) { |
| |
| urlParsingNode.setAttribute('href', href); |
| href = urlParsingNode.href; |
| } |
|
|
| urlParsingNode.setAttribute('href', href); |
|
|
| |
| return { |
| href: urlParsingNode.href, |
| protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', |
| host: urlParsingNode.host, |
| search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', |
| hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', |
| hostname: urlParsingNode.hostname, |
| port: urlParsingNode.port, |
| pathname: (urlParsingNode.pathname.charAt(0) === '/') ? |
| urlParsingNode.pathname : |
| '/' + urlParsingNode.pathname |
| }; |
| } |
|
|
| originURL = resolveURL(window.location.href); |
|
|
| |
| |
| |
| |
| |
| |
| return function isURLSameOrigin(requestURL) { |
| var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; |
| return (parsed.protocol === originURL.protocol && |
| parsed.host === originURL.host); |
| }; |
| })() : |
|
|
| |
| (function nonStandardBrowserEnv() { |
| return function isURLSameOrigin() { |
| return true; |
| }; |
| })() |
| ); |
|
|
|
|
| }), |
|
|
| "./lib/helpers/normalizeHeaderName.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| var utils = __webpack_require__( "./lib/utils.js"); |
|
|
| module.exports = function normalizeHeaderName(headers, normalizedName) { |
| utils.forEach(headers, function processHeader(value, name) { |
| if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { |
| headers[normalizedName] = value; |
| delete headers[name]; |
| } |
| }); |
| }; |
|
|
|
|
| }), |
|
|
| "./lib/helpers/parseHeaders.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| var utils = __webpack_require__( "./lib/utils.js"); |
|
|
| |
| |
| var ignoreDuplicateOf = [ |
| 'age', 'authorization', 'content-length', 'content-type', 'etag', |
| 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', |
| 'last-modified', 'location', 'max-forwards', 'proxy-authorization', |
| 'referer', 'retry-after', 'user-agent' |
| ]; |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| module.exports = function parseHeaders(headers) { |
| var parsed = {}; |
| var key; |
| var val; |
| var i; |
|
|
| if (!headers) { return parsed; } |
|
|
| utils.forEach(headers.split('\n'), function parser(line) { |
| i = line.indexOf(':'); |
| key = utils.trim(line.substr(0, i)).toLowerCase(); |
| val = utils.trim(line.substr(i + 1)); |
|
|
| if (key) { |
| if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { |
| return; |
| } |
| if (key === 'set-cookie') { |
| parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); |
| } else { |
| parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; |
| } |
| } |
| }); |
|
|
| return parsed; |
| }; |
|
|
|
|
| }), |
|
|
| "./lib/helpers/spread.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| module.exports = function spread(callback) { |
| return function wrap(arr) { |
| return callback.apply(null, arr); |
| }; |
| }; |
|
|
|
|
| }), |
|
|
| "./lib/helpers/validator.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| var VERSION = __webpack_require__( "./lib/env/data.js").version; |
|
|
| var validators = {}; |
|
|
| |
| ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) { |
| validators[type] = function validator(thing) { |
| return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type; |
| }; |
| }); |
|
|
| var deprecatedWarnings = {}; |
|
|
| |
| |
| |
| |
| |
| |
| |
| validators.transitional = function transitional(validator, version, message) { |
| function formatMessage(opt, desc) { |
| return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : ''); |
| } |
|
|
| |
| return function(value, opt, opts) { |
| if (validator === false) { |
| throw new Error(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : ''))); |
| } |
|
|
| if (version && !deprecatedWarnings[opt]) { |
| deprecatedWarnings[opt] = true; |
| |
| console.warn( |
| formatMessage( |
| opt, |
| ' has been deprecated since v' + version + ' and will be removed in the near future' |
| ) |
| ); |
| } |
|
|
| return validator ? validator(value, opt, opts) : true; |
| }; |
| }; |
|
|
| |
| |
| |
| |
| |
| |
|
|
| function assertOptions(options, schema, allowUnknown) { |
| if (typeof options !== 'object') { |
| throw new TypeError('options must be an object'); |
| } |
| var keys = Object.keys(options); |
| var i = keys.length; |
| while (i-- > 0) { |
| var opt = keys[i]; |
| var validator = schema[opt]; |
| if (validator) { |
| var value = options[opt]; |
| var result = value === undefined || validator(value, opt, options); |
| if (result !== true) { |
| throw new TypeError('option ' + opt + ' must be ' + result); |
| } |
| continue; |
| } |
| if (allowUnknown !== true) { |
| throw Error('Unknown option ' + opt); |
| } |
| } |
| } |
|
|
| module.exports = { |
| assertOptions: assertOptions, |
| validators: validators |
| }; |
|
|
|
|
| }), |
|
|
| "./lib/utils.js": |
| |
| |
| |
| |
| (function(module, exports, __webpack_require__) { |
|
|
| "use strict"; |
|
|
|
|
| var bind = __webpack_require__( "./lib/helpers/bind.js"); |
|
|
| |
|
|
| var toString = Object.prototype.toString; |
|
|
| |
| |
| |
| |
| |
| |
| function isArray(val) { |
| return Array.isArray(val); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| function isUndefined(val) { |
| return typeof val === 'undefined'; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| function isBuffer(val) { |
| return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) |
| && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| function isArrayBuffer(val) { |
| return toString.call(val) === '[object ArrayBuffer]'; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| function isFormData(val) { |
| return toString.call(val) === '[object FormData]'; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| function isArrayBufferView(val) { |
| var result; |
| if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { |
| result = ArrayBuffer.isView(val); |
| } else { |
| result = (val) && (val.buffer) && (isArrayBuffer(val.buffer)); |
| } |
| return result; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| function isString(val) { |
| return typeof val === 'string'; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| function isNumber(val) { |
| return typeof val === 'number'; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| function isObject(val) { |
| return val !== null && typeof val === 'object'; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| function isPlainObject(val) { |
| if (toString.call(val) !== '[object Object]') { |
| return false; |
| } |
|
|
| var prototype = Object.getPrototypeOf(val); |
| return prototype === null || prototype === Object.prototype; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| function isDate(val) { |
| return toString.call(val) === '[object Date]'; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| function isFile(val) { |
| return toString.call(val) === '[object File]'; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| function isBlob(val) { |
| return toString.call(val) === '[object Blob]'; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| function isFunction(val) { |
| return toString.call(val) === '[object Function]'; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| function isStream(val) { |
| return isObject(val) && isFunction(val.pipe); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| function isURLSearchParams(val) { |
| return toString.call(val) === '[object URLSearchParams]'; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| function trim(str) { |
| return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, ''); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function isStandardBrowserEnv() { |
| if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || |
| navigator.product === 'NativeScript' || |
| navigator.product === 'NS')) { |
| return false; |
| } |
| return ( |
| typeof window !== 'undefined' && |
| typeof document !== 'undefined' |
| ); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function forEach(obj, fn) { |
| |
| if (obj === null || typeof obj === 'undefined') { |
| return; |
| } |
|
|
| |
| if (typeof obj !== 'object') { |
| |
| obj = [obj]; |
| } |
|
|
| if (isArray(obj)) { |
| |
| for (var i = 0, l = obj.length; i < l; i++) { |
| fn.call(null, obj[i], i, obj); |
| } |
| } else { |
| |
| for (var key in obj) { |
| if (Object.prototype.hasOwnProperty.call(obj, key)) { |
| fn.call(null, obj[key], key, obj); |
| } |
| } |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function merge() { |
| var result = {}; |
| function assignValue(val, key) { |
| if (isPlainObject(result[key]) && isPlainObject(val)) { |
| result[key] = merge(result[key], val); |
| } else if (isPlainObject(val)) { |
| result[key] = merge({}, val); |
| } else if (isArray(val)) { |
| result[key] = val.slice(); |
| } else { |
| result[key] = val; |
| } |
| } |
|
|
| for (var i = 0, l = arguments.length; i < l; i++) { |
| forEach(arguments[i], assignValue); |
| } |
| return result; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| function extend(a, b, thisArg) { |
| forEach(b, function assignValue(val, key) { |
| if (thisArg && typeof val === 'function') { |
| a[key] = bind(val, thisArg); |
| } else { |
| a[key] = val; |
| } |
| }); |
| return a; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| function stripBOM(content) { |
| if (content.charCodeAt(0) === 0xFEFF) { |
| content = content.slice(1); |
| } |
| return content; |
| } |
|
|
| module.exports = { |
| isArray: isArray, |
| isArrayBuffer: isArrayBuffer, |
| isBuffer: isBuffer, |
| isFormData: isFormData, |
| isArrayBufferView: isArrayBufferView, |
| isString: isString, |
| isNumber: isNumber, |
| isObject: isObject, |
| isPlainObject: isPlainObject, |
| isUndefined: isUndefined, |
| isDate: isDate, |
| isFile: isFile, |
| isBlob: isBlob, |
| isFunction: isFunction, |
| isStream: isStream, |
| isURLSearchParams: isURLSearchParams, |
| isStandardBrowserEnv: isStandardBrowserEnv, |
| forEach: forEach, |
| merge: merge, |
| extend: extend, |
| trim: trim, |
| stripBOM: stripBOM |
| }; |
|
|
|
|
| }) |
|
|
| }); |
| }); |
| |