Skip to content

Commit

Permalink
Remove object-assign
Browse files Browse the repository at this point in the history
Cudos to @f0rmat1k
  • Loading branch information
floatdrop committed Dec 2, 2015
1 parent dac0122 commit a46d1a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
13 changes: 6 additions & 7 deletions index.js
Expand Up @@ -7,7 +7,6 @@ const PassThrough = require('stream').PassThrough;
const duplexer2 = require('duplexer2');
const urlLib = require('url');
const querystring = require('querystring');
const objectAssign = require('object-assign');
const isStream = require('is-stream');
const getStream = require('get-stream');
const timedOut = require('timed-out');
Expand Down Expand Up @@ -41,7 +40,7 @@ function requestAsEventEmitter(opts) {
}

const redirectUrl = urlLib.resolve(urlLib.format(opts), res.headers.location);
const redirectOpts = objectAssign({}, opts, urlLib.parse(redirectUrl));
const redirectOpts = Object.assign({}, opts, urlLib.parse(redirectUrl));

ee.emit('redirect', res, redirectOpts);

Expand Down Expand Up @@ -195,13 +194,13 @@ function normalizeArguments(url, opts) {
}
}

opts = objectAssign(
opts = Object.assign(
{protocol: 'http:', path: '', retries: 5},
url,
opts
);

opts.headers = objectAssign({
opts.headers = Object.assign({
'user-agent': 'https://github.com/sindresorhus/got',
'accept-encoding': 'gzip,deflate'
}, lowercaseKeys(opts.headers));
Expand Down Expand Up @@ -286,7 +285,7 @@ const helpers = [
];

helpers.forEach(el => {
got[el] = (url, opts) => got(url, objectAssign({}, opts, {method: el.toUpperCase()}));
got[el] = (url, opts) => got(url, Object.assign({}, opts, {method: el.toUpperCase()}));
});

got.stream = function (url, opts) {
Expand All @@ -295,7 +294,7 @@ got.stream = function (url, opts) {

helpers.forEach(el => {
got.stream[el] = function (url, opts) {
return got.stream(url, objectAssign({}, opts, {method: el.toUpperCase()}));
return got.stream(url, Object.assign({}, opts, {method: el.toUpperCase()}));
};
});

Expand All @@ -304,7 +303,7 @@ function stdError(error, opts) {
this.code = error.code;
}

objectAssign(this, {
Object.assign(this, {
message: error.message,
host: opts.host,
hostname: opts.hostname,
Expand Down
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -53,7 +53,6 @@
"is-stream": "^1.0.0",
"lowercase-keys": "^1.0.0",
"node-status-codes": "^1.0.0",
"object-assign": "^4.0.1",
"timed-out": "^2.0.0",
"unzip-response": "^1.0.0",
"url-parse-lax": "^1.0.0"
Expand Down

0 comments on commit a46d1a4

Please sign in to comment.