Skip to content

Commit a1d16dd

Browse files
refactor: use an object spread instead of Object.assign (#6939)
Co-authored-by: Jay <[email protected]>
1 parent 07183cd commit a1d16dd

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

bin/RepoBot.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ class RepoBot {
2424
templates
2525
} = options || {};
2626

27-
this.templates = Object.assign({
28-
published: NOTIFY_PR_TEMPLATE
29-
}, templates);
27+
this.templates = {
28+
published: NOTIFY_PR_TEMPLATE,
29+
...templates
30+
};
3031

3132
this.github = api || new GithubAPI(owner, repo);
3233

lib/core/mergeConfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export default function mergeConfig(config1, config2) {
9696
headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
9797
};
9898

99-
utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
99+
utils.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
100100
const merge = mergeMap[prop] || mergeDeepProperties;
101101
const configValue = merge(config1[prop], config2[prop], prop);
102102
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);

lib/helpers/toURLEncodedForm.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ import toFormData from './toFormData.js';
55
import platform from '../platform/index.js';
66

77
export default function toURLEncodedForm(data, options) {
8-
return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
8+
return toFormData(data, new platform.classes.URLSearchParams(), {
99
visitor: function(value, key, path, helpers) {
1010
if (platform.isNode && utils.isBuffer(value)) {
1111
this.append(key, value.toString('base64'));
1212
return false;
1313
}
1414

1515
return helpers.defaultVisitor.apply(this, arguments);
16-
}
17-
}, options));
16+
},
17+
...options
18+
});
1819
}

0 commit comments

Comments
 (0)