mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-28 03:15:16 +00:00
1 line
9.4 KiB
JSON
1 line
9.4 KiB
JSON
|
{"ast":null,"code":"'use strict';\n\nvar utils = require('../utils');\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n * @returns {Object} New object resulting from merging config2 to config1\n */\n\n\nmodule.exports = function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n var config = {};\n var valueFromConfig2Keys = ['url', 'method', 'data'];\n var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];\n var defaultToConfig2Keys = ['baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer', 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName', 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress', 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent', 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'];\n var directMergeKeys = ['validateStatus'];\n\n function getMergedValue(target, source) {\n if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n return utils.merge(target, source);\n } else if (utils.isPlainObject(source)) {\n return utils.merge({}, source);\n } else if (utils.isArray(source)) {\n return source.slice();\n }\n\n return source;\n }\n\n function mergeDeepProperties(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(config1[prop], config2[prop]);\n } else if (!utils.isUndefined(config1[prop])) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n }\n\n utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(undefined, config2[prop]);\n }\n });\n utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);\n utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(undefined, config2[prop]);\n } else if (!utils.isUndefined(config1[prop])) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n });\n utils.forEach(directMergeKeys, function merge(prop) {\n if (prop in config2) {\n config[prop] = getMergedValue(config1[prop], config2[prop]);\n } else if (prop in config1) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n });\n var axiosKeys = valueFromConfig2Keys.concat(mergeDeepPropertiesKeys).concat(defaultToConfig2Keys).concat(directMergeKeys);\n var otherKeys = Object.keys(config1).concat(Object.keys(config2)).filter(function filterAxiosKeys(key) {\n return axiosKeys.indexOf(key) === -1;\n });\n utils.forEach(otherKeys, mergeDeepProperties);\n return config;\n};","map":{"version":3,"sources":["/app/node_modules/axios/lib/core/mergeConfig.js"],"names":["utils","require","module","exports","mergeConfig","config1","config2","config","valueFromConfig2Keys","mergeDeepPropertiesKeys","defaultToConfig2Keys","directMergeKeys","getMergedValue","target","source","isPlainObject","merge","isArray","slice","mergeDeepProperties","prop","isUndefined","undefined","forEach","valueFromConfig2","defaultToConfig2","axiosKeys","concat","otherKeys","Object","keys","filter","filterAxiosKeys","key","indexOf"],"mappings":"AAAA;;AAEA,IAAIA,KAAK,GAAGC,OAAO,CAAC,UAAD,CAAnB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACAC,MAAM,CAACC,OAAP,GAAiB,SAASC,WAAT,CAAqBC,OAArB,EAA8BC,OAA9B,EAAuC;AACtD;AACAA,EAAAA,OAAO,GAAGA,OAAO,IAAI,EAArB;AACA,MAAIC,MAAM,GAAG,EAAb;AAEA,MAAIC,oBAAoB,GAAG,CAAC,KAAD,EAAQ,QAAR,EAAkB,MAAlB,CAA3B;AACA,MAAIC,uBAAuB,GAAG,CAAC,SAAD,EAAY,MAAZ,EAAoB,OAApB,EAA6B,QAA7B,CAA9B;AACA,MAAIC,oBAAoB,GAAG,CACzB,SADyB,EACd,kBADc,EACM,mBADN,EAC2B,kBAD3B,EAEzB,SAFyB,EAEd,gBAFc,EAEI,iBAFJ,EAEuB,SAFvB,EAEkC,cAFlC,EAEkD,gBAFlD,EAGzB,gBAHyB,EAGP,kBAHO,EAGa,oBAHb,EAGmC,YAHnC,EAIzB,kBAJyB,EAIL,eAJK,EAIY,cAJZ,EAI4B,WAJ5B,EAIyC,WAJzC,EAKzB,YALyB,EAKX,a
|