peerjs-server/lib/util.js
2014-11-01 21:48:46 -07:00

32 lines
713 B
JavaScript

var util = {
debug: false,
inherits: function(ctor, superCtor) {
ctor.super_ = superCtor;
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
});
},
extend: function(dest, source) {
source = source || {};
for(var key in source) {
if(source.hasOwnProperty(key)) {
dest[key] = source[key];
}
}
return dest;
},
randomId: function () {
return (Math.random().toString(36) + '0000000000000000000').substr(2, 16);
},
prettyError: function (msg) {
console.log('ERROR PeerServer: ', msg);
}
};
module.exports = util;