mirror of
https://github.com/tenrok/axios.git
synced 2026-06-23 20:40:40 +03:00
refactor: use an object spread instead of Object.assign (#6939)
Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
committed by
GitHub
parent
07183cd149
commit
a1d16dd9c5
+4
-3
@@ -24,9 +24,10 @@ class RepoBot {
|
|||||||
templates
|
templates
|
||||||
} = options || {};
|
} = options || {};
|
||||||
|
|
||||||
this.templates = Object.assign({
|
this.templates = {
|
||||||
published: NOTIFY_PR_TEMPLATE
|
published: NOTIFY_PR_TEMPLATE,
|
||||||
}, templates);
|
...templates
|
||||||
|
};
|
||||||
|
|
||||||
this.github = api || new GithubAPI(owner, repo);
|
this.github = api || new GithubAPI(owner, repo);
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ export default function mergeConfig(config1, config2) {
|
|||||||
headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
|
headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
|
||||||
};
|
};
|
||||||
|
|
||||||
utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
utils.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
|
||||||
const merge = mergeMap[prop] || mergeDeepProperties;
|
const merge = mergeMap[prop] || mergeDeepProperties;
|
||||||
const configValue = merge(config1[prop], config2[prop], prop);
|
const configValue = merge(config1[prop], config2[prop], prop);
|
||||||
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import toFormData from './toFormData.js';
|
|||||||
import platform from '../platform/index.js';
|
import platform from '../platform/index.js';
|
||||||
|
|
||||||
export default function toURLEncodedForm(data, options) {
|
export default function toURLEncodedForm(data, options) {
|
||||||
return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
|
return toFormData(data, new platform.classes.URLSearchParams(), {
|
||||||
visitor: function(value, key, path, helpers) {
|
visitor: function(value, key, path, helpers) {
|
||||||
if (platform.isNode && utils.isBuffer(value)) {
|
if (platform.isNode && utils.isBuffer(value)) {
|
||||||
this.append(key, value.toString('base64'));
|
this.append(key, value.toString('base64'));
|
||||||
@@ -13,6 +13,7 @@ export default function toURLEncodedForm(data, options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return helpers.defaultVisitor.apply(this, arguments);
|
return helpers.defaultVisitor.apply(this, arguments);
|
||||||
}
|
},
|
||||||
}, options));
|
...options
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user