2014-06-26 23:05:47 +00:00
|
|
|
var _ = require("lodash");
|
|
|
|
|
|
|
|
module.exports = Network;
|
|
|
|
|
2014-06-29 01:07:38 +00:00
|
|
|
var id = 0;
|
|
|
|
|
2014-06-26 23:05:47 +00:00
|
|
|
function Network(attr) {
|
|
|
|
_.merge(this, _.extend({
|
2014-06-29 01:07:38 +00:00
|
|
|
id: id++,
|
2014-06-26 23:05:47 +00:00
|
|
|
connected: false,
|
|
|
|
slate: null,
|
|
|
|
host: "",
|
|
|
|
name: capitalize(this.host.split(".")[1]) || this.host,
|
|
|
|
channels: []
|
|
|
|
}, attr));
|
|
|
|
}
|
|
|
|
|
|
|
|
function capitalize(str) {
|
|
|
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
|
|
}
|