Created
July 25, 2017 20:57
-
-
Save yeffrimic/3e22b413e60ba13783f302f71cfbf1e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
context.msg = context.msg || {}; | |
switch (msg.topic){ | |
case 'message': | |
context.msg.payload = msg.payload; | |
break; | |
case 'topic': | |
context.msg.topic = msg.payload; | |
break; | |
case 'submit': | |
if(context.msg.topic){ | |
return context.msg; | |
}else{ | |
context.msg.topic="#"; // set default topic | |
return context.msg; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment