File Explorer

/proc/self/root/var/runtime/node_modules/@aws-sdk/node_modules/mqtt/lib

This explorer reads the filesystem of the server it runs on, so /workspace/user isn't present here. Browsing and the terminal still work against this server's own disk from /.

topic-alias-recv.js1.1 KB · 48 lines
'use strict' /** * Topic Alias receiving manager * This holds alias to topic map * @param {Number} [max] - topic alias maximum entries */function TopicAliasRecv (max) {  if (!(this instanceof TopicAliasRecv)) {    return new TopicAliasRecv(max)  }  this.aliasToTopic = {}  this.max = max} /** * Insert or update topic - alias entry. * @param {String} [topic] - topic * @param {Number} [alias] - topic alias * @returns {Boolean} - if success return true otherwise false */TopicAliasRecv.prototype.put = function (topic, alias) {  if (alias === 0 || alias > this.max) {    return false  }  this.aliasToTopic[alias] = topic  this.length = Object.keys(this.aliasToTopic).length  return true} /** * Get topic by alias * @param {String} [topic] - topic * @returns {Number} - if mapped topic exists return topic alias, otherwise return undefined */TopicAliasRecv.prototype.getTopicByAlias = function (alias) {  return this.aliasToTopic[alias]} /** * Clear all entries */TopicAliasRecv.prototype.clear = function () {  this.aliasToTopic = {}} module.exports = TopicAliasRecv