return typeof s === 'string' && toNumber(s) === false;
}
-exports.createServer = function() {
- return new Server(arguments[0], arguments[1]);
+exports.createServer = function(options, connectionListener) {
+ return new Server(options, connectionListener);
};
}
-function Server(/* [ options, ] listener */) {
- if (!(this instanceof Server)) return new Server(arguments[0], arguments[1]);
+function Server(options, connectionListener) {
+ if (!(this instanceof Server))
+ return new Server(options, connectionListener);
+
events.EventEmitter.call(this);
var self = this;
-
var options;
- if (typeof arguments[0] === 'function') {
+ if (typeof options === 'function') {
+ connectionListener = options;
options = {};
- self.on('connection', arguments[0]);
+ self.on('connection', connectionListener);
} else {
- options = arguments[0] || {};
+ options = options || {};
- if (typeof arguments[1] === 'function') {
- self.on('connection', arguments[1]);
+ if (typeof connectionListener === 'function') {
+ self.on('connection', connectionListener);
}
}