Closed dhayaljaswantgit closed 2 years ago
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch @xmpp/jid@0.13.0 for the project I'm working on.
@xmpp/jid@0.13.0
Here is the diff that solved my problem:
diff --git a/node_modules/@xmpp/jid/lib/parse.js b/node_modules/@xmpp/jid/lib/parse.js index 4211a81..02b8542 100644 --- a/node_modules/@xmpp/jid/lib/parse.js +++ b/node_modules/@xmpp/jid/lib/parse.js @@ -1,22 +1,31 @@ -"use strict"; +'use strict' -const JID = require("../lib/JID"); +const JID = require('../lib/JID') module.exports = function parse(s) { - let local; - let resource; + if(typeof s === 'object'){ + let newS = s._local+'@'+s._domain; + if(s._resource){ + newS +='/'+_resource; + } - const resourceStart = s.indexOf("/"); + s = newS; + } + let local + let resource + + + const resourceStart = s && s.indexOf('/') if (resourceStart !== -1) { - resource = s.slice(resourceStart + 1); - s = s.slice(0, resourceStart); + resource = s && s.slice(resourceStart + 1) + s = s && s.slice(0, resourceStart) } - const atStart = s.indexOf("@"); + const atStart = s && s.indexOf('@') if (atStart !== -1) { - local = s.slice(0, atStart); - s = s.slice(atStart + 1); + local = s && s.slice(0, atStart) + s = s && s.slice(atStart + 1) } - return new JID(local, s, resource); -}; + return new JID(local, s, resource) +}
This issue body was partially generated by patch-package.
Please either explain the problem here or open a PR with tests.
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch
@xmpp/jid@0.13.0
for the project I'm working on.Here is the diff that solved my problem:
This issue body was partially generated by patch-package.