index.js
function make_clean_topic(tokens) {
	return tokens.map(function (token) {
		if (token.type === "raw") return token.piece.slice(0, -1);
		else if (token.type === "single") return "+";
		else if (token.type === "multi") return "#";
		else return ""; // Wat
	}).join("/");
}
function make_clean_topic(tokens) {
	return tokens.map(function (token) {
		if (token.type === "raw") return token.piece.slice(0, -1);
		else if (token.type === "single") return "+";
		else if (token.type === "multi") return "#";
		else return ""; // Wat
	}).join("/");
}
function make_clean_topic ( tokens ) { return tokens . map ( function ( token ) { if ( token . type === "raw" ) return token . piece . slice ( 0 , - 1 ) ; else if ( token . type === "single" ) return "+" ; else if ( token . type === "multi" ) return "#" ; else return "" ; // Wat } ) . join ( "/" ) ; }
Turn a topic pattern into a regular MQTT topic
Turn a topic pattern into a regular MQTT topic