@wishcore/wish-sdk
Version:
Wish API for node. Used for building Wish Apps.
36 lines • 995 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Peer = void 0;
class Peer {
constructor() {
}
static from(peerLike) {
const peer = new Peer();
Object.assign(peer, peerLike);
return peer;
}
toUrl() {
return [
this.luid.toString('hex') + '>',
this.ruid.toString('hex') + '@',
this.rhid.toString('hex') + '/',
this.rsid.toString('hex') + '/',
this.protocol
].join('');
}
equals(b) {
return this.toUrl() === b.toUrl();
}
toString() {
return [
'<Peer ',
this.luid.toString('hex').substr(0, 6) + '>',
this.ruid.toString('hex').substr(0, 6) + '@',
this.rhid.toString('hex').substr(0, 6) + '/',
this.rsid.toString('hex').substr(0, 6) + '/',
this.protocol + '>'
].join('');
}
}
exports.Peer = Peer;
//# sourceMappingURL=peer.js.map