Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_route({type, name, id, stanza}, next) {
if (!isReply({name, type})) return next()
const deferred = this.handlers.get(id)
if (!deferred) {
return next()
}
if (type === 'error') {
deferred.reject(StanzaError.fromElement(stanza.getChild('error')))
} else {
deferred.resolve(stanza)
}
this.handlers.delete(id)
}