File tree 2 files changed +16
-5
lines changed
2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change 16
16
var EventEmitter = require ( 'events' ) . EventEmitter ;
17
17
var util = require ( 'util' ) ;
18
18
19
- util . mixin ( native , EventEmitter ) ;
19
+ util . mixin ( native . prototype , EventEmitter . prototype ) ;
20
20
21
21
var uart = {
22
22
open : function ( config , callback ) {
Original file line number Diff line number Diff line change @@ -74,12 +74,23 @@ function inherits(ctor, superCtor) {
74
74
}
75
75
76
76
77
- function mixin ( target , source ) {
78
- for ( var prop in source . prototype ) {
79
- if ( source . hasOwnProperty ( prop ) ) {
80
- target . prototype [ prop ] = source . prototype [ prop ] ;
77
+ function mixin ( target ) {
78
+ if ( isNullOrUndefined ( target ) ) {
79
+ throw new TypeError ( 'target cannot be null or undefined' ) ;
80
+ }
81
+
82
+ for ( var i = 1 ; i < arguments . length ; ++ i ) {
83
+ var source = arguments [ i ] ;
84
+ if ( ! isNullOrUndefined ( source ) ) {
85
+ for ( var prop in source ) {
86
+ if ( source . hasOwnProperty ( prop ) ) {
87
+ target [ prop ] = source [ prop ] ;
88
+ }
89
+ }
81
90
}
82
91
}
92
+
93
+ return target ;
83
94
}
84
95
85
96
function format ( s ) {
You can’t perform that action at this time.
0 commit comments