Skip to content

Commit

Permalink
Merge pull request #19 from uphold/enhancement/remove-lodash-dependency
Browse files Browse the repository at this point in the history
Remove lodash dependency
  • Loading branch information
fixe committed Apr 28, 2016
2 parents f826d31 + 08c3642 commit b3f0580
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
1 change: 0 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* Module dependencies.
*/

let _ = require('lodash');
let fallbackErrorMapper = require('./mappers/fallback-error-mapper');
let httpErrorMapper = require('./mappers/http-error-mapper');
let util = require('util');
Expand Down
6 changes: 2 additions & 4 deletions mappers/http-error-mapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

const STATUS_CODE_TO_NAME = require('http').STATUS_CODES;

let _ = require('lodash');

/**
* `Error` mapper.
*/
Expand All @@ -16,13 +14,13 @@ let _ = require('lodash');
module.exports.map = function(e) {
let proto = Object.getPrototypeOf(e);

if (!(_.has(proto, 'expose') && _.has(proto, 'status') && _.has(proto, 'statusCode') )) {
if (!(proto.hasOwnProperty('expose') && proto.hasOwnProperty('status') && proto.hasOwnProperty('statusCode') )) {
return;
}

return {
body: {
code: _.snakeCase(STATUS_CODE_TO_NAME[e.status]),
code: STATUS_CODE_TO_NAME[e.status].replace(/\s+/g, '_').toLowerCase(),
message: e.expose ? e.message : STATUS_CODE_TO_NAME[e.status]
},
status: e.status
Expand Down
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
"engines": {
"iojs": ">= v1.0.0"
},
"dependencies": {
"lodash": "^3.5.0"
},
"devDependencies": {
"co-mocha": "^1.1.0",
"co-supertest": "^0.0.8",
Expand Down

0 comments on commit b3f0580

Please sign in to comment.