Skip to content

Commit

Permalink
馃摝 Bump to lodash 4
Browse files Browse the repository at this point in the history
  • Loading branch information
louib authored and louib committed Apr 15, 2020
1 parent c3b4d22 commit cc0412f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -24,8 +24,8 @@
"dependencies": {
"bluebird": "2",
"create-error": "0.3",
"needle": "clearbit/needle#84d28b5f2c3916db1e7eb84aeaa9d976cc40054b",
"lodash": "2"
"lodash": "4.x",
"needle": "clearbit/needle#84d28b5f2c3916db1e7eb84aeaa9d976cc40054b"
},
"devDependencies": {
"chai": "1",
Expand Down
2 changes: 1 addition & 1 deletion src/client.js
Expand Up @@ -79,7 +79,7 @@ ClearbitClient.prototype.request = function (options) {
.spread(function (response, body) {
if (response.statusCode === 202 || response.statusCode >= 400) {
var message = body.error ? body.error.message : http.STATUS_CODES[response.statusCode] || 'Unknown';
throw _.extend(new this.ClearbitError(message), {
throw _.assign(new this.ClearbitError(message), {
type: body.error ? body.error.type : 'unknown',
body: body,
statusCode: response.statusCode
Expand Down
22 changes: 11 additions & 11 deletions src/resource.js
Expand Up @@ -5,11 +5,11 @@ var _ = require('lodash');

function ClearbitResource (data) {
this.options = {};
_.extend(this, data);
_.assign(this, data);
}

ClearbitResource.get = function (path, options) {
options = _.extend({
options = _.assign({
path: path,
method: 'get',
query: extractParams(options)
Expand All @@ -27,7 +27,7 @@ ClearbitResource.get = function (path, options) {
};

ClearbitResource.post = function (path, options) {
options = _.extend({
options = _.assign({
path: path,
method: 'post',
json: true,
Expand All @@ -43,7 +43,7 @@ ClearbitResource.post = function (path, options) {
};

ClearbitResource.del = function (path, options) {
options = _.extend({
options = _.assign({
path: path,
method: 'delete'
}, this.options, options);
Expand All @@ -66,20 +66,20 @@ exports.create = function (name, options) {
ClearbitResource.apply(this, arguments);
};

_.extend(Resource, ClearbitResource, createErrors(name), {
_.assign(Resource, ClearbitResource, createErrors(name), {
name: name,
options: options
});

return _.extend(function (client) {
return _.extend(Resource, {
return _.assign(function (client) {
return _.assign(Resource, {
client: client
});
},
{
extend: function (proto, ctor) {
_.extend(Resource.prototype, proto);
_.extend(Resource, ctor);
_.assign(Resource.prototype, proto);
_.assign(Resource, ctor);
return this;
}
});
Expand Down Expand Up @@ -108,11 +108,11 @@ function createErrors (name) {
}

function extractParams (options) {
var params = _.omit(options || {},
var params = _.omit(options || {}, [
'path', 'method', 'params',
'client', 'api', 'stream',
'headers', 'timeout'
);
]);

return _.isEmpty(params) ? null : params;
}

0 comments on commit cc0412f

Please sign in to comment.