Skip to content

Commit

Permalink
Remove auxiliary extend method.
Browse files Browse the repository at this point in the history
  • Loading branch information
RubenVerborgh committed Oct 21, 2016
1 parent 6464a73 commit 0d99bbd
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ RedirectableRequest.prototype._processResponse = function (response) {
var location = response.headers.location;
var redirectUrl = url.resolve(this._currentUrl, location);
debug('redirecting to', redirectUrl);
extend(this._options, url.parse(redirectUrl));
Object.assign(this._options, url.parse(redirectUrl));
this._currentResponse = response;
this._performRequest();
};
Expand Down Expand Up @@ -119,16 +119,6 @@ RedirectableRequest.prototype._write = function (chunk, encoding, callback) {
this._currentRequest.write(chunk, encoding, callback);
};

// copies source's own properties onto destination and returns destination
function extend(destination, source) {
var keys = Object.keys(source);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
destination[key] = source[key];
}
return destination;
}

// Export a wrapper for each native protocol
Object.keys(nativeProtocols).forEach(function (protocol) {
var scheme = protocol.substr(0, protocol.length - 1);
Expand All @@ -140,7 +130,7 @@ Object.keys(nativeProtocols).forEach(function (protocol) {
options = url.parse(options);
options.maxRedirects = exports.maxRedirects;
} else {
options = extend({
options = Object.assign({
maxRedirects: exports.maxRedirects,
protocol: protocol
}, options);
Expand Down

0 comments on commit 0d99bbd

Please sign in to comment.