Skip to content

Commit 73059c8

Browse files
committedMay 26, 2016
no longer depend on lodash
1 parent 4fa2461 commit 73059c8

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed
 

‎lib/helpers/class-generator.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
var util = require('util');
2-
var _ = require('lodash');
32
var globalize = require('../internal/globalize');
43

54
module.exports = function generateErrorClass(name, options){

‎lib/http-status.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
var http = require('http');
22
var util = require('util');
3-
var _ = require('lodash');
43

54
var STATUS_CODE_ATTRIBUTE_NAME = module.exports.STATUS_CODE_ATTRIBUTE_NAME = 'status';
65

@@ -61,4 +60,8 @@ var code_map = HttpStatusError.code_map = {
6160
"AlreadyInUseError": 409,
6261
};
6362

64-
var message_map = HttpStatusError.message_map = _.extend({}, http.STATUS_CODES);
63+
var codes = {};
64+
Object.keys(http.STATUS_CODES).forEach(function(key){
65+
codes[key] = http.STATUS_CODES[key];
66+
});
67+
var message_map = HttpStatusError.message_map = codes;

‎lib/internal/globalize.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
var util = require('util');
2-
var _ = require('lodash');
32
var key = "__COMMON-ERRORS-TYPES__";
43
var global_errors = global[key] = global[key] || {};
54

@@ -8,6 +7,10 @@ module.exports = function global_extend(Class) {
87
var global_class = global_errors[Class.name] = global_errors[Class.name] || Class;
98
Class.prototype = Class.__global_prototype__ = global_class.prototype;
109
Class.prototype.global_initialize = Class.prototype.global_initialize || function global_initialize(Class){
11-
_.extend(this, Class.__original_prototype__);
10+
var proto_keys = Object.keys(Class.__original_prototype__);
11+
for(var i = 0; i<proto_keys.length; i++) {
12+
var proto_key = proto_keys[i];
13+
this[proto_key] = Class.__original_prototype__[proto_key];
14+
}
1215
};
1316
}

‎package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "common-errors",
33
"author": "David Fenster <david@dfenster.com>",
44
"description": "Common error classes and utility functions",
5-
"version": "0.5.3",
5+
"version": "0.5.4",
66
"repository": {
77
"type": "git",
88
"url": "https://github.com/shutterstock/node-common-errors.git"
@@ -14,7 +14,6 @@
1414
}
1515
],
1616
"dependencies": {
17-
"lodash": "= 3.10.1"
1817
},
1918
"devDependencies": {
2019
"mocha": "*",
@@ -23,7 +22,8 @@
2322
"common-errors": "git://github.com/shutterstock/node-common-errors.git#global_extend.v1",
2423
"express": "4.x.x",
2524
"express3": "git://github.com/dfenster/express3.git",
26-
"body-parser": "*"
25+
"body-parser": "*",
26+
"lodash": "= 3.10.1"
2727
},
2828
"keywords": [
2929
"common",

0 commit comments

Comments
 (0)
Please sign in to comment.