function Path (path) {
this.family = 'unix'
this.path = path
}
Path.prototype.toString = function () {
return this.path
}
Path.prototype.listen = function () {
var vargs = Array.prototype.slice.call(arguments)
var server = vargs.shift()
vargs.unshift(this.path)
server.listen.apply(server, vargs)
}
Path.prototype.connect = function (connect) {
connect.path = this.path
return connect
}
function Bindable (address, port) {
this.family = 'IPv4'
this.address = address
this.port = port
}
Bindable.prototype.toString = function () {
return this.address + ':' + this.port
}
Bindable.prototype.listen = function () {
var vargs = Array.prototype.slice.call(arguments)
var server = vargs.shift()
vargs.unshift(this.port, this.address)
server.listen.apply(server, vargs)
}
Bindable.prototype.connect = function (connect) {
connect.port = this.port
connect.hostname = this.address == '0.0.0.0' ? '127.0.0.1' : this.address
return connect
}
function isNumeric (value) {
return !isNaN(parseFloat(value)) && isFinite(value)
}