Mercurial > eldonilo > lightstring
diff jid.js @ 25:06e3a883d3a3
Add a JID comparison function.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Fri, 27 Jan 2012 00:05:17 +0100 |
parents | 6a6bb8ded046 |
children | c06ec02217ee |
line wrap: on
line diff
--- a/jid.js +++ b/jid.js @@ -38,6 +38,15 @@ Lightstring.JID.prototype = { return this.full; }, + equals: function(aJID) { + if (!(aJID instanceof Lightstring.JID)) + aJID = new Lightstring.JID(aJID); + + return (this.node === aJID.node && + this.domain === aJID.domain && + this.resource === aJID.resource) + }, + get bare() { if (!this.domain) return null;