File tree 4 files changed +13
-8
lines changed
4 files changed +13
-8
lines changed Original file line number Diff line number Diff line change 1
1
var util = require ( 'util' ) ;
2
- var _ = require ( 'lodash' ) ;
3
2
var globalize = require ( '../internal/globalize' ) ;
4
3
5
4
module . exports = function generateErrorClass ( name , options ) {
Original file line number Diff line number Diff line change 1
1
var http = require ( 'http' ) ;
2
2
var util = require ( 'util' ) ;
3
- var _ = require ( 'lodash' ) ;
4
3
5
4
var STATUS_CODE_ATTRIBUTE_NAME = module . exports . STATUS_CODE_ATTRIBUTE_NAME = 'status' ;
6
5
@@ -61,4 +60,8 @@ var code_map = HttpStatusError.code_map = {
61
60
"AlreadyInUseError" : 409 ,
62
61
} ;
63
62
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 ;
Original file line number Diff line number Diff line change 1
1
var util = require ( 'util' ) ;
2
- var _ = require ( 'lodash' ) ;
3
2
var key = "__COMMON-ERRORS-TYPES__" ;
4
3
var global_errors = global [ key ] = global [ key ] || { } ;
5
4
@@ -8,6 +7,10 @@ module.exports = function global_extend(Class) {
8
7
var global_class = global_errors [ Class . name ] = global_errors [ Class . name ] || Class ;
9
8
Class . prototype = Class . __global_prototype__ = global_class . prototype ;
10
9
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
+ }
12
15
} ;
13
16
}
Original file line number Diff line number Diff line change 2
2
"name" : " common-errors" ,
3
3
"author" : " David Fenster <david@dfenster.com>" ,
4
4
"description" : " Common error classes and utility functions" ,
5
- "version" : " 0.5.3 " ,
5
+ "version" : " 0.5.4 " ,
6
6
"repository" : {
7
7
"type" : " git" ,
8
8
"url" : " https://github.com/shutterstock/node-common-errors.git"
14
14
}
15
15
],
16
16
"dependencies" : {
17
- "lodash" : " = 3.10.1"
18
17
},
19
18
"devDependencies" : {
20
19
"mocha" : " *" ,
23
22
"common-errors" : " git://github.com/shutterstock/node-common-errors.git#global_extend.v1" ,
24
23
"express" : " 4.x.x" ,
25
24
"express3" : " git://github.com/dfenster/express3.git" ,
26
- "body-parser" : " *"
25
+ "body-parser" : " *" ,
26
+ "lodash" : " = 3.10.1"
27
27
},
28
28
"keywords" : [
29
29
" common" ,
You can’t perform that action at this time.
0 commit comments