Skip to content

Commit a2fff6f

Browse files
committed
don't use __proto__, closes socketio#170
1 parent ee38824 commit a2fff6f

File tree

4 files changed

+41
-17
lines changed

4 files changed

+41
-17
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11

22
module.exports = process.env.EIO_COV
3-
? require('./lib-cov/engine.io')
4-
: require('./lib/engine.io');
3+
? require('./lib-cov')
4+
: require('./lib');

lib/engine.io.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -153,18 +153,3 @@ exports.attach = function (server, options) {
153153

154154
return engine;
155155
};
156-
157-
/**
158-
* Invoking the library as a function delegates to attach
159-
*
160-
* @param {http.Server} server
161-
* @param {Object} options
162-
* @return {Server} engine server
163-
* @api public
164-
*/
165-
166-
module.exports = function() {
167-
return exports.attach.apply(this, arguments);
168-
};
169-
170-
module.exports.__proto__ = exports;

lib/index.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
/**
3+
* Module dependencies.
4+
*/
5+
6+
var engine = require('./engine.io')
7+
, util = require('./util');
8+
9+
/**
10+
* Invoking the library as a function delegates to attach
11+
*
12+
* @param {http.Server} server
13+
* @param {Object} options
14+
* @return {Server} engine server
15+
* @api public
16+
*/
17+
18+
exports = module.exports = function() {
19+
return this.attach.apply(this, arguments);
20+
};
21+
22+
/**
23+
* Merge engine.
24+
*/
25+
26+
util.merge(exports, engine);

lib/util.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
/**
3+
* Merge `a` <= `b`
4+
*
5+
* @param {Object} a
6+
* @param {Object} b
7+
* @return {Object} b
8+
*/
9+
10+
exports.merge = function(a, b){
11+
for (var k in b) a[k] = b[k];
12+
return a;
13+
};

0 commit comments

Comments
 (0)